orderUpdate
Requires access scope or
access scope. Also: The app must have the
access scope to assign events to another staff member.
Updates the attributes of an order, such as the customer's email, the shipping address for the order, tags, and metafields associated with the order.
If you need to make significant updates to an order, such as adding or removing line items, changing
quantities, or modifying discounts, then use
the
mutation instead. The
mutation initiates an order editing session,
allowing you to make multiple changes before finalizing them. Learn more about using the
mutation to edit existing orders.
Learn how to build apps that integrate with order management and fulfillment processes.
Arguments
- Anchor to inputinput•Order
Input! required The attributes of the updated order.
Anchor to OrderUpdatePayload returnsOrderUpdatePayload returns
- Anchor to orderorder•
The updated order.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
- Update an order's shipping address and note
- Update an order's tags and customer email address
- orderUpdate reference
Examples
mutation OrderUpdate($input: OrderInput!) {
orderUpdate(input: $input) {
order {
id
note
shippingAddress {
address1
city
province
zip
country
}
}
userErrors {
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation OrderUpdate($input: OrderInput!) { orderUpdate(input: $input) { order { id note shippingAddress { address1 city province zip country } } userErrors { field message } } }",
"variables": {
"input": {
"id": "gid://shopify/Order/148977776",
"shippingAddress": {
"address1": "190 MacLaren",
"city": "Sudbury",
"province": "Ontario",
"zip": "K2P0V6",
"country": "Canada"
},
"note": "Please gift wrap the snowboard."
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation OrderUpdate($input: OrderInput!) {
orderUpdate(input: $input) {
order {
id
note
shippingAddress {
address1
city
province
zip
country
}
}
userErrors {
field
message
}
}
}`,
{
variables: {
"input": {
"id": "gid://shopify/Order/148977776",
"shippingAddress": {
"address1": "190 MacLaren",
"city": "Sudbury",
"province": "Ontario",
"zip": "K2P0V6",
"country": "Canada"
},
"note": "Please gift wrap the snowboard."
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation OrderUpdate($input: OrderInput!) {
orderUpdate(input: $input) {
order {
id
note
shippingAddress {
address1
city
province
zip
country
}
}
userErrors {
field
message
}
}
}`,
"variables": {
"input": {
"id": "gid://shopify/Order/148977776",
"shippingAddress": {
"address1": "190 MacLaren",
"city": "Sudbury",
"province": "Ontario",
"zip": "K2P0V6",
"country": "Canada"
},
"note": "Please gift wrap the snowboard."
}
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation OrderUpdate($input: OrderInput!) {
orderUpdate(input: $input) {
order {
id
note
shippingAddress {
address1
city
province
zip
country
}
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"input": {
"id": "gid://shopify/Order/148977776",
"shippingAddress": {
"address1": "190 MacLaren",
"city": "Sudbury",
"province": "Ontario",
"zip": "K2P0V6",
"country": "Canada"
},
"note": "Please gift wrap the snowboard."
}
}
response = client.query(query: query, variables: variables)