Customize a B2B Subflow
You can use the default checkout subflows or modify them by removing, adding, and reordering steps or exchanging part of a default subflow with a custom subflow.
Required Editions |
---|
Available in: Enterprise, Unlimited, and Developer Editions |
Required Editions |
---|
Available in: B2B Commerce |
The default checkout flow doesn’t show a Previous button during checkout. Instead, the flow references the checkout state variable to determine which screen to show or which integration to run. If you add a Previous button, make sure that the button resets to the checkout state that corresponds to the screen shown and doesn’t revert to the previous checkout state. For example, if an integration runs between screens, reverting to the previous checkout state can result in unexpected behavior or errors.
-
To replace an existing subflow with a custom subflow, drag a new subflow element onto your flow canvas.
We recommend that you keep the Shipping Address subflow first and the Payments subflow at the end. The Shipping Address subflow determines the information related to shipping that the rest of the flow requires. Ending with the Payments subflow minimizes the number of unused payment authorizations on the payment gateway.
-
Enter or search for the type of subflow that you want to add.
-
For the nextState and cartId input values, select Include.
-
Under cartId, add
{!cartId}
.This variable represents the ID value of the current cart.
-
Under nextState, add the subflow that comes next.
Each subflow contains a currentState and a nextState variable. If the nextState variable doesn’t accurately reflect the next subflow, the flow can’t continue, and the checkout hangs. If you delete or reorder a subflow, make sure to update the nextState variable to the correct state value.
For example, if you replace the Shipping Address subflow and you want inventory to come next like it does in the default flow, select Inventory.
-
Delete the subflow that you want to replace.
-
On the Main Decision Hub element, drag the connector to your new subflow, and then drag the connector on your new subflow to the subflow that follows.
-
Save and activate your flow.
To complete your checkout flow, create Apex classes for pricing, tax, shipping, and inventory. For information about creating Apex classes and customizing your flow, see Lightning B2B Commerce Checkout Flow.