Demandware: How to get promotion using shipping method ID

389 views Asked by At

I been searching this through reading the documentation how to get the promotion attached to the shipping method which I am planning to use the shipping method ID as identifier.

Looks like this code :

dw.order.ShippingLineItem.getShippingPriceAdjustments()

But I don't know how can I get the promotion using the shipping method ID.

Anyone?

1

There are 1 answers

0
Dustin Tran On
PromotionMgr.getActiveCustomerPromotions().getShippingPromotions(shippingMethod : ShippingMethod)

Explanation:

  • getActiveCustomerPromotions() get all activated promotions for current user (storefront user). You can get global promotions by getActivePromotions()
  • getShippingPromotions() get promotions will be activated for specific shipping method
  • Get shipping method via ShippingMgr class.