OrderAPI
The API for interacting with the order, available on the Order status page.
Anchor to orderconfirmationapiOrderConfirmationApi
The API object provided to purchase.thank-you
extension targets.
- Anchor to orderConfirmationorderConfirmationStatefulRemoteSubscribable<>required
Order information that's available post-checkout.
OrderConfirmationApi
- orderConfirmation
Order information that's available post-checkout.
StatefulRemoteSubscribable<OrderConfirmation>
export interface OrderConfirmationApi {
/**
* Order information that's available post-checkout.
*/
orderConfirmation: StatefulRemoteSubscribable<OrderConfirmation>;
}
OrderConfirmation
- number
A randomly generated alpha-numeric identifier for the order. For orders created in 2024 and onwards, the number will always be present. For orders created before that date, the number might not be present.
string
- order
{ id: string; }
export interface OrderConfirmation {
order: {
/**
* The globally-uniqueID of the OrderConfirmation. This will be the ID of the Order once successfully created.
*/
id: string;
};
/**
* A randomly generated alpha-numeric identifier for the order.
* For orders created in 2024 and onwards, the number will always be present. For orders created before that date, the number might not be present.
*/
number?: string;
}
Anchor to orderstatusapiOrderStatusApi
The API object provided to customer-account.order-status
extension targets.
- Anchor to orderorderStatefulRemoteSubscribable< | undefined>required
Order information that's available post-checkout.
Docs_OrderStatus_OrderApi
- order
Order information that's available post-checkout.
StatefulRemoteSubscribable<Order | undefined>
export interface Docs_OrderStatus_OrderApi
extends Pick<OrderStatusApi, 'order'> {}
Order
Information about an order that was placed.
- cancelledAt
If cancelled, the time at which the order was cancelled.
string
- confirmationNumber
A randomly generated alpha-numeric identifier for the order. For orders created in 2024 and onwards, the number will always be present. For orders created before that date, the number might not be present.
string
- id
A globally-unique identifier.
string
- name
Unique identifier for the order that appears on the order.
string
- processedAt
The date and time when the order was processed. Processing happens after the checkout has completed, and indicates that the order is available in the admin.
string
export interface Order {
/**
* A globally-unique identifier.
* @example 'gid://shopify/Order/1'
*/
id: string;
/**
* Unique identifier for the order that appears on the order.
* @example '#1000'
*/
name: string;
/**
* If cancelled, the time at which the order was cancelled.
*/
cancelledAt?: string;
/**
* The date and time when the order was processed.
* Processing happens after the checkout has completed, and indicates that the order is available in the admin.
*/
processedAt?: string;
/**
* A randomly generated alpha-numeric identifier for the order.
* For orders created in 2024 and onwards, the number will always be present. For orders created before that date, the number might not be present.
*/
confirmationNumber?: string;
}
Anchor to useOrderuse Order()
Returns the order information that's available on the Order status page.
Anchor to useOrder-returnsReturns
UseOrderGeneratedType
Returns the order information that's available post-checkout.
Order | undefined
export function useOrder<
Target extends RenderExtensionTarget = RenderExtensionTarget,
>(): Order | undefined {
const api = useApi<Target>();
if ('order' in api) {
return useSubscription(api.order);
}
throw new ExtensionHasNoMethodError('order', api.extension.target);
}
Order
Information about an order that was placed.
- cancelledAt
If cancelled, the time at which the order was cancelled.
string
- confirmationNumber
A randomly generated alpha-numeric identifier for the order. For orders created in 2024 and onwards, the number will always be present. For orders created before that date, the number might not be present.
string
- id
A globally-unique identifier.
string
- name
Unique identifier for the order that appears on the order.
string
- processedAt
The date and time when the order was processed. Processing happens after the checkout has completed, and indicates that the order is available in the admin.
string
export interface Order {
/**
* A globally-unique identifier.
* @example 'gid://shopify/Order/1'
*/
id: string;
/**
* Unique identifier for the order that appears on the order.
* @example '#1000'
*/
name: string;
/**
* If cancelled, the time at which the order was cancelled.
*/
cancelledAt?: string;
/**
* The date and time when the order was processed.
* Processing happens after the checkout has completed, and indicates that the order is available in the admin.
*/
processedAt?: string;
/**
* A randomly generated alpha-numeric identifier for the order.
* For orders created in 2024 and onwards, the number will always be present. For orders created before that date, the number might not be present.
*/
confirmationNumber?: string;
}
Order confirmation
examples
Order confirmation
React
import { reactExtension, Banner, useApi, useSubscription, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.thank-you.block.render', () => <Extension />, ); function Extension() { const {orderConfirmation} = useApi(); const {id} = useSubscription(orderConfirmation); if (id) { return ( <Banner> Please include your order confirmation ID ({id}) in support requests </Banner> ); } return null; }
JavaScript
import { Banner, extension, } from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.thank-you.block.render', (root, {orderConfirmation}) => { let bannerShown = false; orderConfirmation.subscribe( (orderConfirmation) => { if (orderConfirmation && !bannerShown) { root.appendChild( root.createComponent( Banner, undefined, `Please include your order confirmation ID (${orderConfirmation.id}) in support requests`, ), ); bannerShown = true; } }, ); }, );
Anchor to examplesExamples
Anchor to example-order-statusOrder status
Use the order
API on the Order status page. This is applicable to the customer-account.orders-status
extension targets only.
Order status
examples
Order status
description
Use the `order` API on the **Order status** page. This is applicable to the `customer-account.orders-status` extension targets only.
React
import { reactExtension, Banner, useOrder, } from '@shopify/ui-extensions-react/customer-account'; export default reactExtension( 'customer-account.order-status.customer-information.render-after', () => <Extension />, ); function Extension() { const order = useOrder(); if (order) { return ( <Banner> Please include your order ID ({order.id}) in support requests </Banner> ); } return null; }
JavaScript
import { Banner, extension, } from '@shopify/ui-extensions/customer-account'; export default extension( 'customer-account.order-status.customer-information.render-after', (root, {order}) => { let bannerShown = false; order.subscribe((order) => { if (order && !bannerShown) { root.appendChild( root.createComponent( Banner, undefined, `Please include your order ID (${order.id}) in support requests`, ), ); bannerShown = true; } }); }, );