Skip to main content

Product API
APIs

The Product API provides an extension with data about the current Product.

Supporting targets

number
required

The unique identifier for the product.

number
required

The unique identifier for the product variant.

Was this section helpful?

Examples of using the Product API.

Was this section helpful?

Retrieve the ID of the product.

import React from 'react';

import {
Text,
Screen,
ScrollView,
Navigator,
reactExtension,
useApi,
} from '@shopify/ui-extensions-react/point-of-sale';

const Modal = () => {
const api = useApi<'pos.product-details.action.render'>();
return (
<Navigator>
<Screen name="ProductApi" title="Product Api">
<ScrollView>
<Text>{`Product ID: ${api.product.id}`}</Text>
</ScrollView>
</Screen>
</Navigator>
);
};

export default reactExtension('pos.product-details.action.render', () => (
<Modal />
));