Create a Promotion Subflow for an Existing Checkout Flow

Checkout flows created before Winter ’22 didn’t support promotions. To add promotion capability to a flow created before Winter ’22, create a subflow.

Required Editions
Available in: Enterprise, Unlimited, and Developer Editions
Required Editions
Available in: B2B Commerce

Your flow must be based on the legacy checkout flow template.

  1. From Setup, in the Quick Find box, enter Flows, and then select Flows.

  2. Click New Flow.

  3. Click All + Templates.

  4. Click Checkout Flow, select Checkout Flow, and then click Next.

  5. Click Freeform.

  6. Drag the Action element onto the canvas.

  7. In the New Action screen, locate Promotions, and select Calculate Cart Promotions.

  8. Define the action.

    1. For the label, enter Calculate Cart Promotions.

    2. For Cart Id, select + New Resource.

    3. For Resource Type, select Variable.

    4. For API Name, enter cartId.

    5. For Data Type, select Text.

    6. Select Available for input.

    7. On the New Resource screen, click Done.

    8. On the New Action screen, click Done.

  9. Drag another Action element onto the canvas.

  10. In the New Action screen, search for "Session" and select Update Checkout Session Action.

  11. Define the action.

    1. Enter Update Checkout Session as the label.

    2. In the Checkout Session Id field, select + New Resource.

    3. Select Variable as the Resource Type.

    4. Enter checkoutSessionId as the API Name.

    5. Select Text as the Data Type.

    6. Select Available for input.

    7. Click Done in the New Resource screen.

    8. In the Next State field, select + New Resource.

    9. Select Variable as the Resource Type.

    10. Enter nextState as the API Name.

    11. Select Text as the Data Type.

    12. Select Available for input.

    13. Click Done in the New Resource screen.

    14. Select Include for the Expected Current State field.

    15. In the Expected Current State field, select + New Resource.

    16. Select Variable as the Resource Type.

    17. Enter currentState as the API Name.

    18. Select Text as the Data Type.

    19. Select Available for input.

    20. Click Done in the New Resource screen.

    21. Click Done in the New Action screen.

  12. Drag the Subflow element onto the canvas.

  13. In the New Subflow screen, search for β€œError” and select Subflow - Error.

  14. Configure the subflow.

    1. Enter Show Error as the Label.

    2. Select Include for the cartId field.

    3. Select the cartId variable for the cartId field.

    4. Select Include for the ErrorMessage field.

    5. Select the Flow.FaultMessage variable for the ErrorMessage field.

    6. Click Done in the New Subflow screen.

  15. Drag a connector line from the Start node to the Update Checkout Session action.

  16. Drag a connector line from the Update Checkout Session to the Calculate Cart Promotions action.

  17. Drag a connector line from the Update Checkout Session action to the Show Error subflow.

  18. Drag two connector lines from the Calculate Cart Promotions action to the Show Error subflow, and delete the solid line.

    The first connector line you drag is solid, and the second is a dashed fault line. Delete the solid line.

    Your subflow looks like this.

    Finished promotion subflow

  19. Click Save.

  20. On the Save the flow screen, enter a label (for example, Calculate Promotions) and click Save.

  21. Click Activate.

    You can now add the subflow to your primary checkout flow.