draft_order_data
The draft order about to be created (Draft Orders, server plan): a quote, or a checkout or buy now with a custom price. An error a filter throws shows in the cart or the form.
On this page
The draft order about to be created (Draft Orders, server plan): a quote, or a checkout or buy now with a custom price. An error a filter throws shows in the cart or the form.
Add it with Smootify.addFilter: answer the value changed, nothing to keep it, or false to stop.
draft_order_data: ( data: DraftOrderData, context: DraftOrderContext, ) => FilterAnswer<DraftOrderData> | Promise<FilterAnswer<DraftOrderData>>Types
DraftOrderData
/** A draft order as Smootify creates it (Draft Orders): what `getCartAsDraftOrderData` answers, what `draft_order_data` filters. */
export interface DraftOrderData {
input: {
lineItems: Record<string, unknown>[];
customAttributes?: { key: string; value: string }[];
note?: string;
presentmentCurrencyCode?: string;
};
customerId?: string;
email?: string;
}DraftOrderContext
export interface DraftOrderContext {
reason: "quote" | "checkout" | "buy-now";
}FilterAnswer
/** What a filter answers: the value changed, nothing (`undefined`) to keep it, `false` to stop. */
export type FilterAnswer<T> = T | false | undefined;