Skip to main content

useExtensionApi
hook

Returns the full API object that was passed in to your extension when it was created. Depending on the extension point, this object can contain different properties.

For example, the Checkout::CartLineDetails::RenderAfter extension point will return the CartLineDetailsApi object. Whereas others return the StandardApi object.

For reference, see ExtensionPoints to determine what API object will be returned by your extension point.

Anchor to useExtensionApi
useExtensionApi()

<ID>
Was this section helpful?

Accessing Properties

React

import React from 'react';
import {
render,
Text,
useExtensionApi,
} from '@shopify/checkout-ui-extensions-react';

render('Checkout::Dynamic::Render', () => (
<Extension />
));

function Extension() {
const {shop} = useExtensionApi();
return <Text>Shop name: {shop.name}</Text>;
}