Calculated Order
Requires access scope.
An order during an active edit session with all proposed changes applied but not yet committed. When you begin editing an order with the mutation, the system creates a that shows how the Order will look after your changes. The calculated order tracks the original order state and all staged modifications (added or removed objects, quantity adjustments, discount changes, and updates). Use the calculated order to preview the financial impact of edits before committing them with the mutation.
Learn more about editing existing orders.
Anchor to FieldsFields
- addedDiscountApplications (CalculatedDiscountApplicationConnection!)
- addedLineItems (CalculatedLineItemConnection!)
- cartDiscountAmountSet (MoneyBag)
- id (ID!)
- lineItems (CalculatedLineItemConnection!)
- notificationPreviewHtml (HTML)
- notificationPreviewTitle (String!)
- originalOrder (Order!)
- shippingLines ([CalculatedShippingLine!]!)
- stagedChanges (OrderStagedChangeConnection!)
- subtotalLineItemsQuantity (Int!)
- subtotalPriceSet (MoneyBag)
- taxLines ([TaxLine!]!)
- totalOutstandingSet (MoneyBag!)
- totalPriceSet (MoneyBag!)
- committed (Boolean!): deprecated
- Anchor to addedDiscountApplicationsadded•Calculated
Discount Applications Discount Application Connection! non-null Returns only the new discount applications being added to the order in the current edit.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Arguments
- Anchor to addedLineItemsadded•Calculated
Line Items Line Item Connection! non-null Returns only the new line items being added to the order during the current edit.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Arguments
- Anchor to cartDiscountAmountSetcart•Money
Discount Amount Set Bag Amount of the order-level discount (doesn't contain any line item discounts) in shop and presentment currencies.
- •ID!non-null
A globally-unique ID.
- Anchor to lineItemsline•Calculated
Items Line Item Connection! non-null Returns all items on the order that existed before starting the edit. Will include any changes that have been made. Will not include line items added during the current edit.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to queryquery•String
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
Arguments
- Anchor to notificationPreviewHtmlnotification•HTML
Preview Html The HTML of the customer notification for the order edit.
- Anchor to notificationPreviewTitlenotification•String!
Preview Title non-null The customer notification title.
- Anchor to originalOrderoriginal•Order!
Order non-null The order without any changes applied.
- Anchor to shippingLinesshipping•[Calculated
Lines Shipping Line!]! non-null Returns the shipping lines on the order that existed before starting the edit. Will include any changes that have been made as well as shipping lines added during the current edit. Returns only the first 250 shipping lines.
- Anchor to stagedChangesstaged•Order
Changes Staged Change Connection! non-null List of changes made to the order during the current edit.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Arguments
- Anchor to subtotalLineItemsQuantitysubtotal•Int!
Line Items Quantity non-null The sum of the quantities for the line items that contribute to the order's subtotal.
- Anchor to subtotalPriceSetsubtotal•Money
Price Set Bag The subtotal of the line items, in shop and presentment currencies, after all the discounts are applied. The subtotal doesn't include shipping. The subtotal includes taxes for taxes-included orders and excludes taxes for taxes-excluded orders.
- Anchor to taxLinestax•[Tax
Lines Line!]! non-null Taxes charged for the line item.
- Anchor to totalOutstandingSettotal•Money
Outstanding Set Bag! non-null Total price of the order less the total amount received from the customer in shop and presentment currencies.
- Anchor to totalPriceSettotal•Money
Price Set Bag! non-null Total amount of the order (includes taxes and discounts) in shop and presentment currencies.
- Anchor to committedcommitted•Boolean!non-nullDeprecated
Anchor to MutationsMutations
- orderEditAddCustomItem (OrderEditAddCustomItemPayload)
- orderEditAddLineItemDiscount (OrderEditAddLineItemDiscountPayload)
- orderEditAddShippingLine (OrderEditAddShippingLinePayload)
- orderEditAddVariant (OrderEditAddVariantPayload)
- orderEditBegin (OrderEditBeginPayload)
- orderEditRemoveDiscount (OrderEditRemoveDiscountPayload)
- orderEditRemoveShippingLine (OrderEditRemoveShippingLinePayload)
- orderEditSetQuantity (OrderEditSetQuantityPayload)
- orderEditUpdateDiscount (OrderEditUpdateDiscountPayload)
- orderEditUpdateShippingLine (OrderEditUpdateShippingLinePayload)
- orderEditRemoveLineItemDiscount (OrderEditRemoveLineItemDiscountPayload): deprecated
- •mutation
Adds a custom line item to an existing
Order. Custom line items represent products or services not in your catalog, such as gift wrapping, installation fees, or one-off charges.Creates a
with the specified title, price, and quantity. Changes remain in the edit session until you commit them with themutation.Learn more about adding custom line items.
- •ID!required
The ID of the calculated order or the order edit session to edit. This is the edit to which the custom item is added.
- Anchor to titletitle•String!required
The name of the custom item to add.
- Anchor to locationIdlocation•ID
Id The ID of the retail location (if applicable) from which the custom item is sold. Used for tax calculations. A default location will be chosen automatically if none is provided.
- Anchor to priceprice•Money
Input! required The unit price of the custom item. This value can't be negative.
- Anchor to quantityquantity•Int!required
The quantity of the custom item. This value must be greater than zero.
- Anchor to taxabletaxable•Boolean
Whether the custom item is taxable. Defaults to
true.- Anchor to requiresShippingrequires•Boolean
Shipping Whether the custom item requires shipping. Defaults to
false.
Arguments
- •ID!
- •mutation
Applies a discount to a
during an order edit session. The discount can be either a fixed amount or percentage value.To modify pricing on specific line items, use this mutation after starting an order edit with the
mutation. The changes remain staged until you commit them with themutation.Learn more about editing existing orders.
- •ID!required
The ID of the calculated order or the order edit session to edit.
- Anchor to lineItemIdline•ID!
Item Id required The ID of the calculated line item to add the discount to.
- Anchor to discountdiscount•Order
Edit Applied Discount Input! required The discount to add to the line item.
Arguments
- •ID!
- •mutation
Adds a custom shipping line to an
Orderduring an edit session. Specify the shipping title and price to create a new.Returns a
showing the order with edits applied but not yet saved. To save your changes, use themutation.Learn more about editing existing orders.
- •ID!required
The ID of the calculated order or the order edit session to edit. This is the edit to which the shipping line is added.
- Anchor to shippingLineshipping•Order
Line Edit Add Shipping Line Input! required The shipping line to be added.
Arguments
- •ID!
- •mutation
Adds a
as a line item to anOrderthat's being edited. The mutation respects the variant's contextual pricing.You can specify a
Locationto check for inventory availability and control whether duplicate variants are allowed. Thequantitymust be a positive value.Learn more about editing existing orders.
- •ID!required
The ID of the calculated order or the order edit session to edit.
- Anchor to variantIdvariant•ID!
Id required The ID of the variant to add.
- Anchor to locationIdlocation•ID
Id The ID of the location to check for inventory availability. A default location ID is chosen automatically if none is provided.
- Anchor to quantityquantity•Int!required
The quantity of the item to add to the order. Must be a positive value.
- Anchor to allowDuplicatesallow•Boolean
Duplicates Default:false Whether the mutation can create a line item for a variant that's already on the calculated order.
Arguments
- •ID!
- •mutation
Starts an order editing session that enables you to modify an existing
Order. This mutation creates anand returns ashowing how the order looks with your changes applied.Order editing follows a three-step workflow: Begin the edit with
, apply changes using mutations likeor, and then save the changes with themutation. The session tracks all staged changes until you commit or abandon them.Learn more about editing existing orders.
- •ID!required
The ID of the order to begin editing.
Arguments
- •ID!
- •mutation
Removes a discount on the current order edit. For more information on how to use the GraphQL Admin API to edit an existing order, refer to Edit existing orders.
- •ID!required
The ID of the calculated order or the order edit session to edit. This is the edit from which the discount is removed.
- Anchor to discountApplicationIddiscount•ID!
Application Id required The ID of the calculated discount application to remove.
Arguments
- •ID!
- •mutation
Removes a shipping line from an existing order. For more information on how to use the GraphQL Admin API to edit an existing order, refer to Edit existing orders.
- •ID!required
The ID of the calculated order or the order edit session to edit. This is the edit from which the shipping line is removed.
- Anchor to shippingLineIdshipping•ID!
Line Id required The ID of the calculated shipping line to remove.
Arguments
- •ID!
- •mutation
Sets the quantity of a line item on an order that's being edited. Use this mutation to increase, decrease, or remove items by adjusting their quantities.
Setting the quantity to zero effectively removes the line item from the order. The item still exists as a data structure with zero quantity. When decreasing quantities, you can optionally restock the removed items to inventory by setting the
restockparameter totrue.Learn more about editing workflows for existing orders.
- •ID!required
The ID of the calculated order or the order edit session to edit. The edit changes the quantity on the line item.
- Anchor to lineItemIdline•ID!
Item Id required The ID of the calculated line item to edit.
- Anchor to quantityquantity•Int!required
The new quantity to set for the line item. This value cannot be negative.
- Anchor to restockrestock•Boolean
Whether or not to restock the line item when the updated quantity is less than the original quantity.
- Anchor to locationIdlocation•ID
Id Deprecated
Arguments
- •ID!
- •mutation
Updates a manual line level discount on the current order edit. For more information on how to use the GraphQL Admin API to edit an existing order, refer to Edit existing orders.
- •ID!required
The ID of the calculated order or the order edit session to edit. This is the edit used to update the discount.
- Anchor to discountdiscount•Order
Edit Applied Discount Input! required The updated discount.
- Anchor to discountApplicationIddiscount•ID!
Application Id required The ID of the calculated discount application to update.
Arguments
- •ID!
- •mutation
Updates a shipping line on the current order edit. For more information on how to use the GraphQL Admin API to edit an existing order, refer to Edit existing orders.
- •ID!required
The ID of the calculated order or the order edit session to edit. This is the edit used to update the shipping line.
- Anchor to shippingLineshipping•Order
Line Edit Update Shipping Line Input! required The updated shipping line.
- Anchor to shippingLineIdshipping•ID!
Line Id required The ID of the calculated shipping line to update.
Arguments
- •ID!
- •mutationDeprecated
- •ID!required
The ID of the calculated order or the order edit session to edit. This is the edit from which the line item discount is removed.
- Anchor to discountApplicationIddiscount•ID!
Application Id required The ID of the calculated discount application to remove.
Arguments
- •ID!