# Configure the main checkout flow

To configure the main checkout flow:

1. Click **Setup** ![](https://2681600133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFDmrn2Xgg8KN7ITpu9Nw%2Fuploads%2F4ZLFovJZkyfVMWtaaYha%2FSetup.png?alt=media).
2. Type `Flows` in the **Quick Find** field and click **Flows**.\
   ![](https://2681600133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFDmrn2Xgg8KN7ITpu9Nw%2Fuploads%2FJOfrXz6Q84oi9ak5Ptk4%2FQuick%20Find%20-%20Flows.png?alt=media)
3. Click **Checkout Flow Template**. The Flow Builder opens in a separate tab.\
   ![](https://2681600133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFDmrn2Xgg8KN7ITpu9Nw%2Fuploads%2FPJeAUdNYNqkGkd6OPY2Y%2FCheckout%20Flow%20Template.png?alt=media)
4. Create the subflow element for all the custom subflows (for example, the [DR Shipping Address](https://docs.digitalriver.com/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.3/integrate-the-salesforce-lightning-app/step-17-integrate-the-digital-river-components-into-the-checkout-flow/subflow-configuration/configure-the-shipping-address-subflow), [DR Payment and Billing Address](https://docs.digitalriver.com/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.3/integrate-the-salesforce-lightning-app/step-17-integrate-the-digital-river-components-into-the-checkout-flow/subflow-configuration/configure-the-payment-and-billing-address-subflow), [DR Checkout Summary](https://docs.digitalriver.com/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.3/integrate-the-salesforce-lightning-app/step-17-integrate-the-digital-river-components-into-the-checkout-flow/subflow-configuration/configure-the-checkout-summary-subflow), and [DR Delivery Method](https://docs.digitalriver.com/salesforce-lightning/salesforce-lightning-b2b-commerce-app-1.3/integrate-the-salesforce-lightning-app/step-17-integrate-the-digital-river-components-into-the-checkout-flow/subflow-configuration/configure-the-delivery-method-subflow)) created in the previous steps.
   1. Drag the **Subflow** element from the left panel to the right panel.
   2. Type the custom subflow name (for example, `DR Shipping Address`) in the **Reference Flow** field and click the item (for example, **DR Payment and Billing Address**) in the search results.
   3. Type the name of the subflow in the **Label** field (for example, **DR Payment and Billing Address**).\
      ![](https://2681600133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFDmrn2Xgg8KN7ITpu9Nw%2Fuploads%2FtgfoeVMY7guk47RAoQTU%2FNew%20Subflow%20Label.png?alt=media)
   4. Type the appropriate value listed in the [subflow settings table](#subflow-settings) for the custom subflow in each field. The following example shows the settings for the DR Payment and Billing Address subflow.\
      ![](https://2681600133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFDmrn2Xgg8KN7ITpu9Nw%2Fuploads%2FNMn98jThMkAhrBQrzAv0%2FNew%20Subflow%20complete.png?alt=media)
   5. Under **Set Input Values**, toggle **cartId**, **currentState**, **nextState**, **orderId** (if applicable) to **Inlude**. Toggle **Saved\_Tax\_Identifier** (if applicable) to **Don't include**.\
      ![](https://2681600133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFDmrn2Xgg8KN7ITpu9Nw%2Fuploads%2F6jNgQncUlWuKlqy3rqV2%2FNew%20Subflow%20Set%20Input%20Values.png?alt=media)
5. Replace the OOTB flows with custom flows.
   * **Shipping Address**: DR Shipping Address
   * **Delivery Method**: DR Delivery Method
   * **Checkout Summary**: DR Checkout Summary
   * **Payment and Billing Address**: DR Payment and Billing Address\
     ![](https://2681600133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFDmrn2Xgg8KN7ITpu9Nw%2Fuploads%2FKW8mzaLecXpFxU6AWy7m%2FReplace%20OOTB%20flow%20with%20custom%20flow.png?alt=media)
6. Click **Save As** and enter a name for the main checkout flow.\
   ![](https://2681600133-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFDmrn2Xgg8KN7ITpu9Nw%2Fuploads%2FPwiVN0BdAg4J1Pcrq9Hd%2FName%20for%20main%20checkout%20flow.png?alt=media)
7. Click **Save**, then click **Activate**.

## Subflow settings

| Subflow                        | Settings                                                                                                                                                                                                                                                                       |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| DR Shipping Address            | <p><strong>Cart Id</strong>: <code>{!cartId}</code><br><strong>Current state</strong>: {<code>!mainCheckoutSession.State}</code><br><strong>Next state</strong>: Inventory</p>                                                                                                 |
| DR Delivery Method             | <p><strong>Cart Id</strong>: <code>{!cartId}</code><br><strong><code>Current</code> state</strong>: {!<code>mainCheckoutSession.State}</code><br><strong>Next state</strong>: Taxes</p>                                                                                        |
| DR Checkout Summary            | <p><strong>Cart Id</strong>: <code>{!cartId}</code><br><strong>Current state</strong>: {!<code>mainCheckoutSession.State}</code><br><strong>Next state</strong>: Cart To Order<br><strong>Saved\_Tax\_Identifier</strong>: {!Saved\_Tax\_Identifier}</p>                       |
| DR Payment and Billing Address | <p><strong>Cart Id</strong>: <code>{!cartId}</code><br><strong>Current state</strong>: {!<code>mainCheckoutSession.State}</code><br><strong>Next state</strong>: Activate Order<br><strong>Order Id</strong>: <code>{!mainCheckout</code><br><code>Session.OrderId}</code></p> |
