Draft Order APIAPIs
APIs
The Draft Order API provides an extension with data about the current draft order.
Supporting targets
Anchor to draftorderapiDraftOrderApi
number
required
The unique identifier for the draft order
Anchor to name
name
string
required
The name of the draft order
Anchor to customerId
customerId
number
The unique identifier of the customer associated with the draft order
Was this section helpful?
Anchor to examplesExamples
Examples of using the Draft Order API.
Anchor to example-retrieve-the-id-of-the-draft-order.Retrieve the ID of the draft order.
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 />
));