Skip to main content

Checkout UI extensions

Extensions add custom UI and logic into any step of the Shopify checkout experience. For example, you can display personalized messages during cart review, integrate custom payment options at checkout, or add a survey to the thank-you page.

By using extension target APIs and web components from Shopify's Polaris design system, you can build performant customizations that look and feel familiar while tailoring the checkout experience to a store's specific needs.

Shopify Plus

Checkout UI extensions for the information, shipping, and payment steps are available only to stores on a Shopify Plus plan.

To get started customizing your store's checkout, scaffold an app extension using Shopify CLI.

Scaffolding the extension creates a file framework that includes your extension's TOML configuration file and a templated Checkout.jsx file where you add your extension's code.


Anchor to Upgrading your extensionUpgrading your extension

The latest version of checkout UI extensions adds new components and target APIs, and updates how extensions read and write metafields. Check out the migration guide for the steps to upgrade your extension.


Anchor to Building your extensionBuilding your extension

Checkout UI extensions are made up of three interconnected parts: targets that determine where your custom UI appears in the checkout interface, target APIs that provide access to checkout data and functionality, and web components that render UI elements like buttons and menus.

Anchor to Targets: Choose where your custom UI appearsTargets: Choose where your custom UI appears

Targets define where your custom UI appears within Shopify's checkout interface. There are three types of targets:

Target typeDescription
BlockFlexible placement targets that merchants can position using the checkout and accounts editor. Merchants can place block targets in various locations throughout the checkout flow and on the Thank you page.
RunnableTargets that provide data or functionality without rendering UI components. These targets run in response to specific events, such as when a customer types in an address field, and return data like autocomplete suggestions or formatted address information.
StaticTargets that appear at fixed locations in checkout, such as before actions, after contact fields, or after cart line items. These targets render automatically when the checkout page loads and can't be moved or repositioned.

Anchor to Target APIs: Define what your extension doesTarget APIs: Define what your extension does

Target APIs provide access to data and functionality within the checkout flow. Use them to add custom logic to your extension.

When your extension runs, Shopify provides a shopify global object that you use to access data and features. Most target APIs are properties on this object. For example, shopify.buyerIdentity gives you information about the buyer who's interacting with the checkout, and shopify.cost provides the cost breakdown for the current checkout.

If your app uses ESLint, update your configuration to include the global shopify object to prevent linting errors.

Anchor to Web components: Design your interfaceWeb components: Design your interface

Web components are the UI building blocks that you use to display data and trigger API functions. These components are native UI elements that follow Shopify's design system and are built with remote-dom, Shopify's library for building cross-platform user interfaces.

The component library includes options like form inputs, buttons, overlays, and feedback indicators. You can use these components individually for simple displays, or combine them with layout primitives like stack, grid, and section to build more complex interfaces.

Anchor to Apply changes: Update the cart and checkoutApply changes: Update the cart and checkout

Some target APIs include methods that update the cart and checkout. For example:

Each method returns a promise that resolves after Shopify applies the change and the corresponding API property updates with the new state.

Rate limits may apply

Rate limits may apply to extensions that make too many changes during a checkout. After an extension is rate limited, it can't make further changes during the buyer's session.

Batch multiple changes with Promise.all. Only apply the changes your extension needs.


You define your extension's configuration in a shopify.extension.toml file. This file contains the extension's name, targeting definitions, API version, and other settings. We recommend that you always set the latest supported api_version in your configuration file.

When you scaffold your extension using Shopify CLI, a shopify.extension.toml file with a default configuration is created for you. As you build your extension, you define the targets you want to use and their corresponding code modules in this file.

Checkout UI extensions use the following configuration properties:

api_version required

The version of the API that's being used for the extension. If provided in the [[extensions]] array, then the specified API version is used instead of the root level api_version.

[[extensions]] required

The name of the array that contains all extensions listed in the TOML file. Contains the following properties:

  • type: required The extension type. For checkout UI extensions, use ui_extension.

  • name: required The customer-facing name of the extension.

    Limitations:

    • 5 characters minimum.
    • 30 characters maximum.
  • handle: required The unique internal identifier for the extension. After you create a draft version of the extension, or deploy an extension, you can't change the handle value.

    Limitations:

    • Allowed characters: a-z, A-Z, 0-9, -.
    • 50 characters maximum.
    • Must be unique within the app.
  • uid: required The extension user identifier that must be unique within the app. An app-scoped identifier used by shopify app deploy to determine whether an extension is being created, updated, or deleted. This identifier is generated automatically when you scaffold your extension using Shopify CLI.

  • description: optional The merchant-facing description of the extension.

[[extensions.targeting]] required

The name of the array that contains a target and its associated module. Contains the following properties:

  • target: required

    An identifier that specifies where you're injecting your extension into the checkout interface.

  • module: required

    The path to the JavaScript or TypeScript file that contains your extension code.

You can define multiple targets in a single configuration file, but each target must point to a separate module file. For block targets, you can also define the default placement. See the targets overview for more details.

[extensions.capabilities] optional

Defines the capabilities associated with your extension.

CapabilityDescription
api_accessAllows your extension to query the Storefront API.
network_accessAllows your extension to make external network calls.
collect_buyer_consentAllows your extension to collect buyer consent for policies like SMS marketing.
block_progressAllows your extension to block the buyer's progress.
[[extensions.metafields]] optional

Define metafields your extension needs access to. Use [[extensions.metafields]] for metafields needed by all targets, or [[extensions.targeting.metafields]] for target-specific metafields.

Checkout targets can use the Metafields API to read metafields you request in the TOML, and to write cart metafields with applyMetafieldChange (updateCartMetafield and removeCartMetafield). Thank you page targets can read metafields through the Metafields API, but don't have write access.

See which resources support metafields and the available metafield data types.

Learn more in the Metafields API reference.

[extensions.settings] optional

Settings let merchants configure your extension from the checkout editor. Each settings definition can include up to 20 settings. All setting inputs are optional. Build your extension so it still works if the merchant hasn't set a value.

Each field in [[extensions.settings.fields]] accepts the following properties:

  • key: required The identifier for the setting. The configured value is exposed under this key at runtime.

  • type: required The setting type. Determines what input the merchant sees and how the value is validated. Supported types: boolean, single_line_text_field, multi_line_text_field, number_integer, number_decimal, date, date_time, and variant_reference.

  • name: required The display name shown to the merchant in the checkout editor.

  • description: optional Help text displayed to the merchant in the checkout editor.

  • validations: optional Constraints on the input that Shopify validates, such as min/max length or a regex pattern. Learn more about validation options.


Anchor to Testing and deploymentTesting and deployment

Shopify CLI provides a set of tools to help you test and deploy your extension.

To run your extension locally during development, start a dev server using Shopify CLI. The dev command creates a preview of your extension on your chosen dev store. If your extension is built on an app with a backend, then this command also serves your backend locally using a Cloudflare tunnel.

The dev server automatically reloads your extension when you make changes to your code, so you can test updates in real-time.

When you're ready to go live, deploy your extension to production using Shopify CLI.

The Shopify CLI deploy command builds your extension bundle and uploads everything to Shopify. If your extension is built on an app with a backend, then you need to deploy your app to a hosting service first. Shopify hosts only your extension's code.

Note

Your compiled UI extension bundle can't exceed 64 KB. Shopify enforces this limit at deployment to ensure fast loading times and optimal performance. Learn how to analyze your bundle size.

Polaris reference docs follow Shopify's API versioning policy. Each stable version is supported for a minimum of 12 months. Older versions continue to work, they just won't have dedicated docs on Shopify.dev. Shopify CLI already prevents deploys targeting API versions older than 12 months, so we recommend keeping your extensions on a supported version.


Checkout UI extensions are a safe and secure way to customize the appearance and functionality of checkout without compromising the security of customer data.

  • They run in an isolated sandbox, separate from the checkout page and other UI extensions.
  • They don't have access to sensitive payment information or the checkout page itself (HTML or other assets).
  • They are limited to specific UI components and APIs that are exposed by the platform.
  • They have limited access to global web APIs.
  • Apps that wish to access protected customer data must submit an application and are subject to strict security guidelines and review processes by Shopify.

To handle errors in your extension, add an unhandledrejection listener for promise rejections or an error listener for other exceptions like Javascript runtime errors or failures to load a resource.

You can also use third party error-reporting libraries. However, these libraries might require extra configuration because UI extensions run inside of a Web Worker which doesn't have access to window or the DOM. You'll typically need to disable default integrations and manually attach error listeners to self.

The third-party tool example shown uses Sentry. To install and initialize this tool, follow their Browser JavaScript guide. We recommend disabling the default integrations to be sure the tool will run within a Web Worker. You'll need to add event listeners manually.

Note

You must request network access to transmit errors to a third party service.



Was this page helpful?