Shipping method definitions and shipping costs
Key Takeaway
Shipping cost has two layers, a shipment-level cost and optional product-level costs. Neither layer can be calculated until the shipment has a shipping method set.
A shipping method defines how a shipment is shipped, such as Next Day shipping. B2C Commerce uses the shipping method to work out what the shopper pays for shipping. Shipping cost has two layers: a shipment-level cost based on the shipment's merchandise total, and optional product-level costs that are either fixed or a surcharge. Developers read and apply these definitions through the dw.order.ShippingMgr class and its product and shipment shipping models.
What a shipping method holds
In code, a dw.order.ShippingMethod object represents how a shipment will be shipped. A shipping method has these attributes:
- An ID
- A display name and a description in the current locale, which are null if none is found
- A currency code
- An online flag
- A tax class ID
- Assigned customer groups
- An optional base method
In a method's customerGroups, any assigned ID that doesn't match an existing customer group is ignored.
ShippingMethod.getDependentMethods() returns the dependent shipping methods regardless of their online status.