Skip to main content

Extension API

The Extension API provides read-only access to metadata about the running extension. Use this API to inspect the current target and API version, check which capabilities are enabled, detect whether the extension is being previewed in the checkout and accounts editor, and check whether the extension is rendered on screen.

  • Display debugging information: Show the active target name and API version during development to verify your extension is running where expected.
  • Check capabilities before rendering: Test whether a capability like block_progress has been granted, and show a warning in the editor when it's missing.
  • Detect the editor context: Use the editor property to adjust behavior according to whether the extension is being previewed in the checkout and accounts editor or running in a live checkout.
  • Defer work until visible: Use the rendered property to detect whether your extension is visible on screen. Shopify might pre-render your extension before the buyer reaches the step where it appears, so you can delay expensive operations until rendered is true.
Support
Targets (33)

The shopify global object provides extension metadata for the current checkout. Access the following properties on shopify to read the extension's target, version, capabilities, and editor context. Available to purchase extension targets.

Anchor to extension
extension
<>
required

Metadata about the running extension, including the current target, API version, capabilities, and editor context. Use this to conditionally render content based on where the extension is running.

Anchor to Available Preact hooksAvailable Preact hooks

The following Preact hooks provide a convenience wrapper that makes it easier to perform common tasks without writing your own logic.

Returns whether or not a given capability of an extension is granted.

Anchor to capability
capability
required


  • Check capabilities in the editor context: Use shopify.extension.editor alongside useExtensionCapability to surface missing permissions only when the merchant is configuring the extension. This helps merchants fix capability issues before publishing.

Was this page helpful?