# Extension The API for interacting with the metadata of an extension. ## StandardApi The base API object provided to `purchase` extension targets. ### Docs_Standard_ExtensionMetaApi ### extension value: `Extension` The meta information about the extension. ### Extension The meta information about an extension target. ### apiVersion value: `ApiVersion` The API version that was set in the extension config file. ### capabilities value: `StatefulRemoteSubscribable` The allowed capabilities of the extension, defined in your [shopify.extension.toml](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) file. * [`api_access`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#api-access): the extension can access the Storefront API. * [`network_access`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#network-access): the extension can make external network calls. * [`block_progress`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#block-progress): the extension can block a customer's progress and the merchant has allowed this blocking behavior. * [`collect_buyer_consent.sms_marketing`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#collect-buyer-consent): the extension can collect customer consent for SMS marketing. * [`collect_buyer_consent.customer_privacy`](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#collect-buyer-consent): the extension can register customer consent decisions that will be honored on Shopify-managed services. ### editor value: `Editor` Information about the editor where the extension is being rendered. If the value is undefined, then the extension is not running in an editor. ### rendered value: `StatefulRemoteSubscribable` A Boolean to show whether your extension is currently rendered to the screen. Shopify might render your extension before it's visible in the UI, typically to pre-render extensions that will appear on a later step of the checkout. Your extension might also continue to run after the customer has navigated away from where it was rendered. The extension continues running so that your extension is immediately available to render if the customer navigates back. ### scriptUrl value: `string` The URL to the script that started the extension target. ### target value: `Target` The identifier that specifies where in Shopify’s UI your code is being injected. This will be one of the targets you have included in your extension’s configuration file. ### version value: `string` The published version of the running extension target. For unpublished extensions, the value is `undefined`. ### Editor ### type value: `"checkout"` Indicates whether the extension is rendering in the checkout editor. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## useExtension Returns the metadata about the extension. ### UseExtensionGeneratedType Returns the metadata about the extension. #### Returns: Extension export function useExtension(): Extension { return useApi().extension as Extension; } ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## useExtensionData Returns the metadata about the extension. This is deprecated, use `useExtension()` instead. ### UseExtensionDataGeneratedType Returns the metadata about the extension. > Caution: This is deprecated, use `useExtension()` instead. #### Returns: Extension export function useExtensionData(): Extension { return useExtension(); } ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## useExtensionCapabilities Returns a list of an extension's granted capabilities. ### UseExtensionCapabilitiesGeneratedType Returns a list of an extension's granted capabilities. #### Returns: Capability[] export function useExtensionCapabilities(): Capability[] { return useSubscription(useApi().extension.capabilities); } ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## useExtensionCapability Returns whether or not a given capability of an extension is granted. ### UseExtensionCapabilityGeneratedType Returns whether or not a given capability of an extension is granted. #### Returns: boolean #### Params: - capability: Capability export function useExtensionCapability(capability: Capability): boolean { return useExtensionCapabilities().includes(capability); } ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## useExtensionEditor Returns information about the editor where the extension is being rendered. ### UseExtensionEditorGeneratedType Returns information about the editor where the extension is being rendered. #### Returns: Editor | undefined export function useExtensionEditor(): Editor | undefined { return useApi().extension.editor; } ### Editor ### type value: `"checkout"` Indicates whether the extension is rendering in the checkout editor. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout)