Skip to main content

Draft Order API
APIs

The Draft Order API provides an extension with data about the current draft order.

Supporting targets

number
required

The unique identifier for the draft order

string
required

The name of the draft order

number

The unique identifier of the customer associated with the draft order

Was this section helpful?

Examples of using the Draft Order API.

Was this section helpful?

Retrieve the ID of the draft order.

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.draft-order-details.action.render'>();
return (
<Navigator>
<Screen name="DraftOrderDetailsAction" title="Draft Order Details Action">
<ScrollView>
<Text>{`Order ID: ${api.draftOrder.id}`}</Text>
</ScrollView>
</Screen>
</Navigator>
);
};

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