orderEditAddCustomItem
Requires access scope. Also: To use the GraphQL Admin API to edit orders, your app needs to request the
access scope for a Shopify store.
Adds a custom line item to an existing order. For example, you could add a gift wrapping service as a custom line item. To learn how to edit existing orders, refer to Edit an existing order with Admin API.
Arguments
- •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 locationIdlocation•
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 requiresShippingrequires•
Shipping Whether the custom item requires shipping. Defaults to
false
.- •
The optional SKU for the custom item to add.
- Anchor to taxabletaxable•
Whether the custom item is taxable. Defaults to
true
.- Anchor to titletitle•String!required
The name of the custom item to add.
- Anchor to weightweight•
Specifies the weight unit and value inputs.
Anchor to OrderEditAddCustomItemPayload returnsOrderEditAddCustomItemPayload returns
- Anchor to calculatedLineItemcalculated•
Line Item The custom line item that will be added to the order based on the current edits.
- Anchor to calculatedOrdercalculated•
Order An order with the edits applied but not saved.
- Anchor to orderEditSessionorder•
Edit Session The order edit session with the edits applied but not saved.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Mutation Reference
1mutation orderEditAddCustomItem($id: ID!, $locationId: ID, $price: MoneyInput!, $quantity: Int!, $requiresShipping: Boolean, $sku: String, $taxable: Boolean, $title: String!, $weight: WeightInput) {2 orderEditAddCustomItem(id: $id, locationId: $locationId, price: $price, quantity: $quantity, requiresShipping: $requiresShipping, sku: $sku, taxable: $taxable, title: $title, weight: $weight) {3 calculatedLineItem {4 # CalculatedLineItem fields5 }6 calculatedOrder {7 # CalculatedOrder fields8 }9 orderEditSession {10 # OrderEditSession fields11 }12 userErrors {13 field14 message15 }16 }17}
Input
1{2 "id": "gid://shopify/<objectName>/10079785100",3 "locationId": "gid://shopify/<objectName>/10079785100",4 "price": {5 "amount": "29.99",6 "currencyCode": ""7 },8 "quantity": 1,9 "requiresShipping": true,10 "sku": "<your-sku>",11 "taxable": true,12 "title": "<your-title>",13 "weight": {14 "unit": "",15 "value": 1.116 }17}
{
"id": "gid://shopify/<objectName>/10079785100",
"locationId": "gid://shopify/<objectName>/10079785100",
"price": {
"amount": "29.99",
"currencyCode": ""
},
"quantity": 1,
"requiresShipping": true,
"sku": "<your-sku>",
"taxable": true,
"title": "<your-title>",
"weight": {
"unit": "",
"value": 1.1
}
}
input MoneyInput {
amount: Decimal!
currencyCode: CurrencyCode!
}
input WeightInput {
unit: WeightUnit!
value: Float!
}