Skip to main content
Migrate to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.

Extension API

The Extension API lets you read metadata about your extension at runtime, including its handle and URL. Use this API to build dynamic URLs that point to your extension, read editor context when it's available, or log extension details for debugging.

  • Build extension URLs: Use the extension's url property to construct links that point back to your extension or share its location with your backend.
  • Conditionally render by editor type: Check editor.type to display different content depending on where the extension is rendered.
  • Log extension details for debugging: Include the extension handle and url in error reports or diagnostic output to identify which extension instance is running.
Support
Targets (25)

The Extension API object provides extension metadata for customer account extensions. Access the following properties on the API object to read your extension's handle, URL, and editor context at runtime.

Anchor to extension
extension
required

Metadata about the extension, including its target, version, and editor context. For configuration details, see shopify.extension.toml.


  • Use the handle for identification: Reference shopify.extension.handle when logging or communicating with your backend so you can identify which extension is active.
  • Check editor type defensively: The editor property may be undefined in some contexts. Always use optional chaining (editor?.type) when accessing it.
  • Don't hardcode extension URLs: Use shopify.extension.url instead of constructing URLs manually. The URL may vary between development and production environments.

  • Extension metadata is read-only. You can't modify the handle, URL, or editor type at runtime.
  • The editor property is only available when the extension is rendered within an editor context. It may be undefined when the extension runs in a live customer-facing environment.
  • The url property reflects the extension's current URL, which may differ between local development and deployed environments.

Was this page helpful?