B2B Commerce checkout flow core actions for cart calculations
Key Takeaway
A cart calculation action needs the cart in the Checkout state, and the flow must wait until the earlier background operation is no longer New or Running before calling it.
The B2B Commerce Checkout flow runs checkout in a Commerce store. The flow comes with prebuilt core actions that you add in Flow Builder. Some of these actions recalculate the cart: repricing, promotions, shipping costs, taxes, and inventory. They take a cart ID, start the work in the background, and return the ID of that background operation. Timing and cart state matter, because a call at the wrong moment fails.
The cart calculation actions
Price Cart requests a reprice of all line items in the cart. Four more actions each request one calculation or check. You use the API name to call an action from the API.
| Action | What it requests | API name |
|---|---|---|
| Calculate Cart Promotions | A full calculation of only the line items that have a promotion | calcCartPromotionsAction |
| Calculate Cart Shipment Costs | The shipping costs of all line items | calcCartShipmentAction |
| Calculate Cart Taxes | A tax cost calculation for all line items | calcCartTaxesAction |
| Check Cart Inventory | A full inventory availability check of all line items | checkCartInventoryAction |