Cert++
Close

Shipping calculation reference implementation

Key Takeaway

To replace the default shipping calculation when the Cart Calculate API is enabled, extend CartExtension.ShippingCartCalculator, override calculate() to populate CartDeliveryGroupMethods, and map the class to Commerce_Domain_Shipping_CartCalculator.

Shipping calculation decides which shipping methods a buyer in a B2B Commerce store can choose at checkout and what each one costs. A developer customizes it with an Apex class, and the Cart Calculate API runs that class as one step in its checkout calculations.

Where shipping fits

Shipping calculation is one calculator inside the Cart Calculate API, which has three levels:

  • Orchestrators choose which calculators run and when.
  • Calculators do cart calculations such as shipping and tax.
  • Services do specific calculations that can reach beyond the cart.

Pricing, inventory and taxes call underlying services that you can extend separately. The shipping calculator doesn't call a service, so your calculator class is where custom shipping logic goes.

Salesforce Accredited B2B Commerce Developer Professional Study Guide

Checklist progress

0/124Learned

Code implementations against the 4 crucial reference implementations used in checkout and payment interfaces with in-depth knowledge of all supported actions

0/23

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other Salesforce Accredited B2B Commerce Developer Professional studiers.