Mutations
The order mutations are designed to allow an external application to pass an order payload (variant IDs, quantities, discounts, etc.) and have Submarine create a Shopify order as well as capture payment for it.
The proposed API follows Shopify's own pattern for draft-order creation. It exposes two mutations: one to calculate what the order will look like, and another to actually create it.
Where possible, we mimic (simplified versions of) Shopify objects and types.
orderCalculate
Calculates the properties of a Shopify order.
Arguments
Field | type | Required? | Description |
---|---|---|---|
input | CalculatedOrderInput! | Yes | The fields for the order. |
Return fields
Field | Type | Description |
---|---|---|
calculatedOrder | CalculatedOrder! | The calculated properties for an order. |
userErrors | [UserError!]! | List of errors that occurred executing the mutation. |
orderCreate
Creates an order and captures payment for it.
Arguments
Field | Type | Required? | Description |
---|---|---|---|
input | OrderInput! | Yes | The fields for the order. |
Return fields
Field | Type | Description |
---|---|---|
order | Order | The created order. |
userErrors | [UserError!]! | List of errors that occurred executing the mutation. |
draftOrderComplete
Captures payment for an existing Shopify draft order and completes it, converting it to a Shopify order.
Arguments
Field | Type | Required? | Description |
---|---|---|---|
input | CompletableDraftOrderInput! | Yes | The fields specifying the draft order and the means to complete it. |
Return fields
Field | Type | Description |
---|---|---|
completedDraftOrder | CompletedDraftOrder! | An object containing information about the completed draft order. |
userErrors | [UserError!]! | List of errors that occurred executing the mutation. |
Updated over 1 year ago