# Configure the main checkout flow

To configure the main checkout flow:

1. Click **Setup** ![](https://content.gitbook.com/content/3R66sN5xrbmDAJUBEoHo/blobs/BcJ2YbwBnYvUoes4Bu0e/Setup.png).
2. Type `Flows` in the **Quick Find** field and click **Flows**.\
   ![](https://content.gitbook.com/content/3R66sN5xrbmDAJUBEoHo/blobs/tHHVcKxkYEiShvYjy7DO/Quick%20Find%20-%20Flows.png)
3. Click **Checkout Flow Template**. The Flow Builder opens in a separate tab.\
   ![](https://content.gitbook.com/content/3R66sN5xrbmDAJUBEoHo/blobs/WALj64TDbAeTB2Gbt9yp/Checkout%20Flow%20Template.png)
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-2.1/integrate-the-salesforce-lightning-app/step-17-integrate-the-digital-river-components-into-the-checkout-flow/integrate-the-digital-river-components-into-an-asynchronous-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-2.1/integrate-the-salesforce-lightning-app/step-17-integrate-the-digital-river-components-into-the-checkout-flow/integrate-the-digital-river-components-into-an-asynchronous-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-2.1/integrate-the-salesforce-lightning-app/step-17-integrate-the-digital-river-components-into-the-checkout-flow/integrate-the-digital-river-components-into-an-asynchronous-checkout-flow/subflow-configuration/configure-the-checkout-summary-subflow), and [DR Delivery Method](https://docs.digitalriver.com/salesforce-lightning/salesforce-lightning-b2b-commerce-app-2.1/integrate-the-salesforce-lightning-app/step-17-integrate-the-digital-river-components-into-the-checkout-flow/integrate-the-digital-river-components-into-an-asynchronous-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://content.gitbook.com/content/3R66sN5xrbmDAJUBEoHo/blobs/9c0hY1dXzmdziHzD9Uh4/New%20Subflow%20Label.png)
   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://content.gitbook.com/content/3R66sN5xrbmDAJUBEoHo/blobs/00BEr6nVbj2lIpFKlBjt/New%20Subflow%20complete.png)
   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://content.gitbook.com/content/3R66sN5xrbmDAJUBEoHo/blobs/uaUk2Qjmrn89kNsmsBZA/New%20Subflow%20Set%20Input%20Values.png)
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://content.gitbook.com/content/3R66sN5xrbmDAJUBEoHo/blobs/NBkvv1DE6Odm9ySfbSSf/Replace%20OOTB%20flow%20with%20custom%20flow.png)
6. Click **Save As** and enter a name for the main checkout flow.\
   ![](https://content.gitbook.com/content/3R66sN5xrbmDAJUBEoHo/blobs/mCknNzm8L1i093al1c2U/Name%20for%20main%20checkout%20flow.png)
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> |
