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

FieldtypeRequired?Description
inputCalculatedOrderInput!YesThe fields for the order.

Return fields

FieldTypeDescription
calculatedOrderCalculatedOrder!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

FieldTypeRequired?Description
inputOrderInput!YesThe fields for the order.

Return fields

FieldTypeDescription
orderOrderThe 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

FieldTypeRequired?Description
inputCompletableDraftOrderInput!YesThe fields specifying the draft order and the means to complete it.

Return fields

FieldTypeDescription
completedDraftOrderCompletedDraftOrder!An object containing information about the completed draft order.
userErrors[UserError!]!List of errors that occurred executing the mutation.