orderEditAddVariant
Requires access scope.
Adds a line item from an existing product variant. As of API version 2025-04, the orderEditAddVariant API will respect the contextual pricing of the variant.
Arguments
- Anchor to allowDuplicatesallow•
Duplicates BooleanDefault:false Whether the mutation can create a line item for a variant that's already on the calculated order.
- •ID!required
The ID of the calculated order to edit.
- Anchor to locationIdlocation•
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 variantIdvariant•
Id ID!required The ID of the variant to add.
Anchor to OrderEditAddVariantPayload returnsOrderEditAddVariantPayload returns
- Anchor to calculatedLineItemcalculated•
Line Item The calculated line item that's added during this order edit.
- Anchor to calculatedOrdercalculated•
Order The calculated order 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
Input
{
"allowDuplicates": true,
"id": "gid://shopify/<objectName>/10079785100",
"locationId": "gid://shopify/<objectName>/10079785100",
"quantity": 1,
"variantId": "gid://shopify/<objectName>/10079785100"
}