> Deprecated: > `checkout.liquid` is now unsupported for the Information, Shipping, and Payment checkout steps. 'checkout.liquid', additional scripts, and script tags are deprecated for the **Thank you** and **Order status** pages and will be sunset on August 28, 2025. > Stores that currently use `checkout.liquid` for the **Thank you** and **Order status** pages need to [upgrade to Checkout Extensibility](https://www.shopify.com/plus/upgrading-to-checkout-extensibility) before the deadline. [Shopify Scripts](/docs/api/liquid/objects#script) will continue to work alongside Checkout Extensibility until August 28, 2025. > Learn [how to build checkout extensions](/docs/apps/build/checkout/technologies) that extend the functionality of Shopify checkout. The `checkout.liquid` layout renders the checkout and is available only to [Shopify Plus](https://www.shopify.com/plus?utm_source=shopify&utm_medium=docs&utm_campaign=checkout_liquid_layout) merchants. If your store isn't on Shopify Plus, then you can customize your checkout pages in the [theme editor](https://help.shopify.com/manual/online-store/themes/customizing-themes/edit#theme-editor). ## Location The `checkout.liquid` layout is located in the `layout` directory of the theme: ```text └── theme ├── layout | ├── theme.liquid | └── checkout.liquid ├── templates ... ``` ## Schema The `checkout.liquid` layout has the following format by default: <p> <div class="react-code-block" data-preset="file"> <div class="react-code-block-preload ThemeMode-dim"> <div class="react-code-block-preload-bar "></div> <div class="react-code-block-preload-placeholder-container"> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> </div> </div> <script data-option="filename" data-value="checkout.liquid"></script> <script type="text/plain" data-language="liquid"> RAW_MD_CONTENT <!DOCTYPE html> <html lang="{{ locale }}" dir="{{ direction }}" class="{{ checkout_html_classes }}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0, height=device-height, minimum-scale=1.0, user-scalable=0"> <meta name="referrer" content="origin"> <title>{{ page_title }}</title> {{ content_for_header }} {{ checkout_stylesheets }} {{ checkout_scripts }} </head> <body> {{ skip_to_content_link }} <header class="banner" data-header role="banner"> <div class="wrap"> {{ content_for_logo }} </div> </header> {{ order_summary_toggle }} <div class="content" data-content> <div class="wrap"> <div class="main"> <header class="main__header" role="banner"> {{ content_for_logo }} {{ breadcrumb }} {{ alternative_payment_methods }} </header> <main class="main__content" role="main"> {{ content_for_layout }} </main> <footer class="main__footer" role="contentinfo"> {{ content_for_footer }} </footer> </div> <aside class="sidebar" role="complementary"> <div class="sidebar__header"> {{ content_for_logo }} </div> <div class="sidebar__content"> {{ content_for_order_summary }} </div> </aside> </div> </div> {{ tracking_code }} </body> </html> END_RAW_MD_CONTENT</script> </div> </p> ## Content The `checkout.liquid` layout has specific [checkout objects](#checkout-objects) to render various checkout content, depending on the [checkout step](#checkout-steps). ### Checkout steps The checkout has the following steps: <table id="checkout-pages"> <thead> <tr> <th>Step</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><strong>Inventory issues</strong></td> <td>This step is displayed if one or more of the cart items is out of stock, or the inventory level is below what the customer has requested. Customers are shown a confirmation button that will update their cart with the available item quantities.</td> </tr> <tr> <td><strong>Contact information</strong></td> <td>The customer enters their email address and will have the option to log in if customer accounts are enabled for the store. If any cart items require shipping, then the customer is shown a shipping address form. Otherwise, the customer is shown a billing address form.</td> </tr> <tr> <td><strong>Shipping method</strong></td> <td>The customer selects a shipping option or edits their shipping information. This step is skipped when none of the cart items require shipping. Skipping the shipping method is common for merchants selling digital products or services. Clicking <strong>Edit shipping information</strong> returns the visitor to the <strong>Customer information</strong> step.</td> </tr> <tr> <td><strong>Payment method</strong></td> <td>The customer chooses a payment method and, if applicable, enters payment information. Some payment providers require the customer to complete payment information on a different site. Customers can also specify a different billing address during this step.</td> </tr> <tr> <td><strong>Review order</strong></td> <td> <p> Optional based on <a href="https://help.shopify.com/manual/checkout-settings">checkout settings</a>. The customer confirms their order total, shipping and billing addresses, and payment details by clicking <strong>Complete order</strong>. </p> <p> This step might be required if the store is operating in the European Union. </p> </td> </tr> <tr> <td><strong>Processing/forwarding</strong></td> <td>A temporary page shown to customers as their order is being processed, or as they are being redirected to an off-site payment provider. The message displayed during this step depends on your checkout's translation settings.</td> </tr> <tr> <td><strong>Order status</strong></td> <td>The last step of checkout. This step is displayed after an order is complete. <a href="https://help.shopify.com/manual/orders/status-tracking">Learn more ›</a></td> </tr> </tbody> </table> On every step, an **Order summary** showing the products, price, taxes, and shipping costs is displayed in the right column. This column collapses at mobile breakpoints. > Tip: > You can use JavaScript to [identify the current step](#step-identification). ### Checkout objects <table> <thead> <tr> <th>Object</th> <th>Description</th> <th>Required</th> </tr> </thead> <tbody> <tr> <td><strong>content_for_header</strong></td> <td>The scripts from Shopify for features like hCaptcha, Shopify apps, and more. You need to add a reference to this object between the <code><head></code> and <code></head></code> HTML tags.</td> <td>Yes</td> </tr> <tr> <td><strong>content_for_layout</strong></td> <td>The form fields and content for each step of the checkout process. You need to add a reference to this object between the <code><body></code> and <code></body></code> HTML tags.</td> <td>Yes</td> </tr> <tr> <td><strong>locale</strong></td> <td>The currently-selected locale.</td> <td>No</td> </tr> <tr> <td><strong>direction</strong></td> <td>The CSS direction of the content. For example, <code>ltr</code> or <code>rtl</code>.</td> <td>No</td> </tr> <tr> <td><strong>page_title</strong></td> <td>The page title. Commonly wrapped in <code><title></code> and <code></title></code> tags.</td> <td>No</td> </tr> <tr> <td><strong>skip_to_content_link</strong></td> <td>A hidden link for accessibility that allows users to skip to the main content.</td> <td>No</td> </tr> <tr> <td><strong>checkout_html_classes</strong></td> <td>A string that should be added to the <code><html></code> tag to benefit from Shopify's default CSS.</td> <td>No</td> </tr> <tr> <td><strong>checkout_stylesheets</strong></td> <td>Shopify's checkout stylesheets. It's recommended that you don't remove this, even if you have your own stylesheets, as it requires extensive work to replace the default styling.</td> <td>No</td> </tr> <tr> <td><strong>checkout_scripts</strong></td> <td>Shopify's JavaScript files.</td> <td>No</td> </tr> <tr> <td><strong>content_for_logo</strong></td> <td>The store logo, as determined by the <a href="https://help.shopify.com/manual/checkout-settings/checkout-style#add-a-logo-to-the-checkout-page">checkout settings</a>.</td> <td>No</td> </tr> <tr> <td><strong>breadcrumb</strong></td> <td>The list of steps required to complete the checkout. The breadcrumb doesn't display on the final review step during checkout.</td> <td>No</td> </tr> <tr> <td><strong>order_summary_toggle</strong></td> <td>The markup necessary to show and hide the order summary on mobile devices.</td> <td>No</td> </tr> <tr> <td><strong>content_for_order_summary</strong></td> <td>The content summary, including line items, discounts, taxes, and totals.</td> <td>No</td> </tr> <tr> <td><strong>alternative_payment_methods</strong></td> <td>The list of available express payment methods, such as PayPal.</td> <td>No</td> </tr> <tr> <td><strong>content_for_footer</strong></td> <td>The list of your store policies or, if the list is empty, a copyright notice.</td> <td>No</td> </tr> <tr> <td><strong>tracking_code</strong></td> <td>The JavaScript responsible for Google Analytics and Facebook Pixel tracking.</td> <td>No</td> </tr> <tr> <td><strong>checkout</strong></td> <td>The <a href="/docs/api/liquid/objects/checkout">checkout object</a>.</td> <td>No</td> </tr> </tbody> </table> > Caution: > If you don't include the required objects in your `checkout.liquid` template, then you can't save or update the file using the code editor or tools like Shopify CLI. ## Usage When working with `checkout.liquid`, you should familiarize yourself with the following concepts: - [How to access `checkout.liquid`](#access-checkout-liquid) - [Considerations for customizing checkout content](#customize-checkout-content) - [How to identify the current checkout step](#step-identification) - [Page events](#page-events) - [Checkout jQuery](#checkout-jquery) - [How to capture checkout attributes](#capture-checkout-attributes) ### Access checkout.liquid To enable or disable access to `checkout.liquid`, Shopify Plus merchants must [contact support](https://help.shopify.com/en/questions#/contact). Before requesting access to `checkout.liquid`, you should be familiar with the following versions of checkout and their implications: <table> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><strong>Standard</strong></td> <td>The default checkout. It's used if access to <code>checkout.liquid</code> isn't enabled, and is automatically updated as Shopify releases updates and features for the checkout.</td> </tr> <tr> <td><strong>Maintenance</strong></td> <td> <p> Used when access to <code>checkout.liquid</code> is enabled. It's a stable version of <code>Standard</code>, frozen at a specific time. This means that it's not automatically updated. If you use <code>Maintenance</code>, then you can get access to updates and features in the following ways: </p> <ul> <li>Disable access to <code>checkout.liquid</code> to move back onto <code>Standard</code>.</li> <li>Wait for <code>Maintenance</code> to be upgraded and follow the <a href="https://help.shopify.com/manual/checkout-settings/checkout-upgrade">manual checkout upgrade process</a>.</li> </ul> </td> </tr> </tbody> </table> #### Add checkout.liquid to your theme If access to `checkout.liquid` has been enabled, then you can follow the steps below to add the layout to your theme through the code editor in the Shopify admin: <div class="section-tabs-container"> <div role="tablist" aria-label="Desktop, iPhone, Android tabs" class="section-tabs"> <button id="tabs-9c2d8f-0" aria-selected="true" aria-disabled="false" aria-controls="content-9c2d8f-0" class="desktop-item section-tabs__tab section-tabs__tab--is-selected" role="tab"> Desktop </button><button id="tabs-9c2d8f-1" aria-selected="false" aria-disabled="false" aria-controls="content-9c2d8f-1" class="iphone-item section-tabs__tab " role="tab"> iPhone </button><button id="tabs-9c2d8f-2" aria-selected="false" aria-disabled="false" aria-controls="content-9c2d8f-2" class="android-item section-tabs__tab " role="tab"> Android </button> </div><div tabindex="0" role="tabpanel" id="content-9c2d8f-0" aria-labelledby="tabs-9c2d8f-0" class="desktop-item section-tabs__content--is-selected section-tabs__content"> <ol> <li><p>From your Shopify admin, go to <strong>Online Store</strong> > <strong>Themes</strong>.</p></li> <li><p>Find the theme that you want to edit, and then click <strong>...</strong> > <strong>Edit code</strong>.</p></li> </ol> </div><div tabindex="0" role="tabpanel" id="content-9c2d8f-1" aria-labelledby="tabs-9c2d8f-1" class="iphone-item section-tabs__content"> <ol> <li><p>From the <a rel="external noreferrer noopener" target="_blank" href="https://www.shopify.com/install/detect">Shopify app</a>, tap <strong>Store</strong>.</p></li> <li><p>In the <strong>Sales channels</strong> section, tap <strong>Online Store</strong>.</p></li> <li><p>Tap <strong>Manage all themes</strong>.</p></li> <li><p>Find the theme that you want to edit, and then tap <strong>...</strong> > <strong>Edit code</strong>.</p></li> </ol> </div><div tabindex="0" role="tabpanel" id="content-9c2d8f-2" aria-labelledby="tabs-9c2d8f-2" class="android-item section-tabs__content"> <ol> <li><p>From the <a rel="external noreferrer noopener" target="_blank" href="https://www.shopify.com/install/detect">Shopify app</a>, tap <strong>Store</strong>.</p></li> <li><p>In the <strong>Sales channels</strong> section, tap <strong>Online Store</strong>.</p></li> <li><p>Tap <strong>Manage all themes</strong>.</p></li> <li><p>Find the theme that you want to edit, and then tap <strong>...</strong> > <strong>Edit code</strong>.</p></li> </ol> </div> </div> 1. In the **Layout** directory, click **Add a new layout**. 2. In the drop-down list, select **checkout**, and then click **Create layout**. You should now see `checkout.liquid` listed in the **Layout** directory. ### Customize checkout content You can't edit the content generated by any of the [checkout objects](#checkout-objects), required or optional, before they're rendered. The only exceptions to this are for translation settings, theme editor settings, and some options made available in the Shopify admin. If you need to customize the content output by a checkout object, then you need to use JavaScript to alter the content after it's been rendered. To learn more about customizing this content, refer to [Best practices for editing checkout.liquid](/docs/storefronts/themes/architecture/layouts/checkout-liquid/customize-checkout). ### Step identification The checkout is all hosted on one page, which means that the URL remains the same regardless of which step of the process a customer is on. To account for this, you can use the following JavaScript objects to identify where the customer is in the checkout process. - [Shopify.Checkout.step](#shopify-checkout-step) - [Shopify.Checkout.page](#shopify-checkout-page) - [Shopify.Checkout.OrderStatus](#shopify-checkout-orderstatus) > Tip: > The above JavaScript objects can be viewed using your browser's developer tools. #### Shopify.Checkout.step An object that shows which step of the checkout the customer is on. It returns one of the following results: - `contact_information` - `shipping_method` - `payment_method` - `processing` - This is the step between the `payment_method` step and the `thank_you` page. - `review` - This is an optional step set in the Shopify Admin. > Note: > This object is defined only when the customer first visits the **Order Status** page. #### Shopify.Checkout.page An object that shows which type of page the customer is on. It returns one of the following results: - `show` - A page template for various steps of the checkout process. - `stock_problems` - A page that displays if there's an inventory issue with any cart items. - `processing` - A page that displays while the payment is being processed. - `forward` - A page from PayPal or another third-party gateway. - `thank_you` > Note: > This object is defined only when the customer first visits the **Order Status** page. #### Shopify.Checkout.OrderStatus An object that can be used for [adding content to the **Order status** page](https://help.shopify.com/en/manual/orders/status-tracking/customize-order-status/order-status-javascript-asset). It can also help determine whether the customer is on a **Thank You** page or an **Order Status** page. The **Order Status** page is usually considered as a `checkout` page. However, the first time a customer visits the page, it's considered as a **Thank You** page, where the `Shopify.Checkout.step` and `Shopify.Checkout.page` objects are defined. If the customer revisits or reloads the page, then this `checkout` is converted to an `order`, and the page loads as an **Order Status** page, where the `Shopify.Checkout.step` and `Shopify.Checkout.page` objects are undefined and the `Shopify.Checkout.OrderStatus` object is defined. ### Page events All of the checkout steps are hosted at a single URL path, where the content is loaded dynamically depending on the current step. There are two main page events that are triggered during this process: - [page:load](#page-load) - [page:change](#page-change) #### page:load The `page:load` event is triggered when the content of each step is loaded. This is the default event that you should use when adding content into the page on load. <p> <div class="react-code-block" data-preset="file"> <div class="react-code-block-preload ThemeMode-dim"> <div class="react-code-block-preload-bar "></div> <div class="react-code-block-preload-placeholder-container"> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> </div> </div> <script data-option="filename" data-value="Example"></script> <script type="text/plain" data-language="javascript"> RAW_MD_CONTENT$(document).on('page:load', function() { // Add content }); END_RAW_MD_CONTENT</script> </div> </p> #### page:change The `page:change` event is triggered when the customer is on the same checkout step, but part of the content has changed. For example, this event triggers when the discount form is submitted. If you add content to the Document Object Model (DOM) with only `page:load`, then there’s a risk that it could be overwritten by a `page:change` event. To avoid this issue, you should watch for both events when adding content. <p> <div class="react-code-block" data-preset="file"> <div class="react-code-block-preload ThemeMode-dim"> <div class="react-code-block-preload-bar "></div> <div class="react-code-block-preload-placeholder-container"> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> </div> </div> <script data-option="filename" data-value="Example"></script> <script type="text/plain" data-language="javascript"> RAW_MD_CONTENT$(document).on("page:load page:change", function() { // Add content }); END_RAW_MD_CONTENT</script> </div> </p> ### Checkout jQuery The checkout contains its own version of jQuery, which can be accessed using `Checkout.$`. <p> <div class="react-code-block" data-preset="file"> <div class="react-code-block-preload ThemeMode-dim"> <div class="react-code-block-preload-bar "></div> <div class="react-code-block-preload-placeholder-container"> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> </div> </div> <script data-option="filename" data-value="Example"></script> <script type="text/plain" data-language="javascript"> RAW_MD_CONTENT(function($) { $(document).on("page:load page:change", function() { // Add your customizations }); })(Checkout.$); END_RAW_MD_CONTENT</script> </div> </p> > Note: > The checkout's version of jQuery is not always the most recent version. If you need any functionality from a more recent version of jQuery, then you'll need to include it specifically. ### Capture checkout attributes You can capture checkout attributes in a similar way to [capturing cart attributes](/docs/api/liquid/objects/cart#cart-attributes). To capture a checkout attribute, include an input with an attribute of `name="checkout[attributes][attribute-name]"`, where `attribute-name` is the desired name of your attribute, inside the main checkout form. <p> <div class="react-code-block" data-preset="file"> <div class="react-code-block-preload ThemeMode-dim"> <div class="react-code-block-preload-bar "></div> <div class="react-code-block-preload-placeholder-container"> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> </div> </div> <script data-option="filename" data-value="Example"></script> <script type="text/plain" data-language="html"> RAW_MD_CONTENT<input type="text" name="checkout[attributes][custom attribute]"> END_RAW_MD_CONTENT</script> </div> </p> > Tip: > If you're collecting attributes on the **Payment method** step, then you should populate them with a placeholder value before allowing the order to proceed. If the attribute has a blank value, then it can cause an error noting that the checkout has changed. Note that capturing checkout attributes will remove any existing cart attributes. To learn how to avoid this issue, refer to [Preserve cart attributes](#preserve-cart-attributes) below. #### Preserve cart attributes When capturing checkout attributes, you can preserve any cart attributes with the `checkout.attributes` Liquid object, which contains the cart attribute values. You can loop through the attributes to add them as checkout attribute inputs with names and values defined by the existing attribute data. This snippet should be included inside a JavaScript function for placing the attribute inputs inside the main form. <p> <div class="react-code-block" data-preset="file"> <div class="react-code-block-preload ThemeMode-dim"> <div class="react-code-block-preload-bar "></div> <div class="react-code-block-preload-placeholder-container"> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> <div class="react-code-block-preload-code-container"> <div class="react-code-block-preload-codeline-number"></div> <div class="react-code-block-preload-codeline"></div> </div> </div> </div> <script data-option="filename" data-value="Example"></script> <script type="text/plain" data-language="liquid"> RAW_MD_CONTENT {% for attribute in checkout.attributes %} <input type=hidden name="checkout[attributes][{{ attribute.first }}]" value="{{ attribute.last }}"> {% endfor %} END_RAW_MD_CONTENT</script> </div> </p>