Anchor to orderEditRemoveShippingLineorder
orderEditRemoveShippingLine
mutation
Requires access scope.
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.
Anchor to Arguments
Arguments
- •ID!required
The ID of the calculated order to edit.
- Anchor to shippingLineIdshipping•
Line Id ID!required The ID of the calculated shipping line to remove.
Was this section helpful?
Anchor to OrderEditRemoveShippingLinePayload returnsOrderEditRemoveShippingLinePayload returns
- Anchor to calculatedOrdercalculated•
Order The calculated order with the edits applied but not saved.
- Anchor to userErrorsuser•
Errors The list of errors that occurred from executing the mutation.
Was this section helpful?
- Remove a staged shipping line from an order edit
- orderEditRemoveShippingLine reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation removeShippingLine($id: ID!, $shippingLineId: ID!) {6 orderEditRemoveShippingLine(id: $id, shippingLineId: $shippingLineId) {7 calculatedOrder {8 id9 totalOutstandingSet {10 presentmentMoney {11 amount12 currencyCode13 }14 }15 totalPriceSet {16 presentmentMoney {17 amount18 currencyCode19 }20 }21 }22 userErrors {23 field24 message25 }26 }27 }`,28 {29 variables: {30 "id": "gid://shopify/CalculatedOrder/607673085",31 "shippingLineId": "gid://shopify/CalculatedShippingLine/6ffda6d8-c0cf-44d6-8aa4-e89cea4a6607"32 },33 },34);3536const data = await response.json();37
mutation removeShippingLine($id: ID!, $shippingLineId: ID!) {
orderEditRemoveShippingLine(id: $id, shippingLineId: $shippingLineId) {
calculatedOrder {
id
totalOutstandingSet {
presentmentMoney {
amount
currencyCode
}
}
totalPriceSet {
presentmentMoney {
amount
currencyCode
}
}
}
userErrors {
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation removeShippingLine($id: ID!, $shippingLineId: ID!) { orderEditRemoveShippingLine(id: $id, shippingLineId: $shippingLineId) { calculatedOrder { id totalOutstandingSet { presentmentMoney { amount currencyCode } } totalPriceSet { presentmentMoney { amount currencyCode } } } userErrors { field message } } }",
"variables": {
"id": "gid://shopify/CalculatedOrder/607673085",
"shippingLineId": "gid://shopify/CalculatedShippingLine/6ffda6d8-c0cf-44d6-8aa4-e89cea4a6607"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation removeShippingLine($id: ID!, $shippingLineId: ID!) {
orderEditRemoveShippingLine(id: $id, shippingLineId: $shippingLineId) {
calculatedOrder {
id
totalOutstandingSet {
presentmentMoney {
amount
currencyCode
}
}
totalPriceSet {
presentmentMoney {
amount
currencyCode
}
}
}
userErrors {
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/CalculatedOrder/607673085",
"shippingLineId": "gid://shopify/CalculatedShippingLine/6ffda6d8-c0cf-44d6-8aa4-e89cea4a6607"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation removeShippingLine($id: ID!, $shippingLineId: ID!) {
orderEditRemoveShippingLine(id: $id, shippingLineId: $shippingLineId) {
calculatedOrder {
id
totalOutstandingSet {
presentmentMoney {
amount
currencyCode
}
}
totalPriceSet {
presentmentMoney {
amount
currencyCode
}
}
}
userErrors {
field
message
}
}
}`,
"variables": {
"id": "gid://shopify/CalculatedOrder/607673085",
"shippingLineId": "gid://shopify/CalculatedShippingLine/6ffda6d8-c0cf-44d6-8aa4-e89cea4a6607"
},
},
});
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 removeShippingLine($id: ID!, $shippingLineId: ID!) {
orderEditRemoveShippingLine(id: $id, shippingLineId: $shippingLineId) {
calculatedOrder {
id
totalOutstandingSet {
presentmentMoney {
amount
currencyCode
}
}
totalPriceSet {
presentmentMoney {
amount
currencyCode
}
}
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"id": "gid://shopify/CalculatedOrder/607673085",
"shippingLineId": "gid://shopify/CalculatedShippingLine/6ffda6d8-c0cf-44d6-8aa4-e89cea4a6607"
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "id": "gid://shopify/CalculatedOrder/607673085",3 "shippingLineId": "gid://shopify/CalculatedShippingLine/6ffda6d8-c0cf-44d6-8aa4-e89cea4a6607"4}
Response
JSON1{2 "orderEditRemoveShippingLine": {3 "calculatedOrder": {4 "id": "gid://shopify/CalculatedOrder/607673085",5 "totalOutstandingSet": {6 "presentmentMoney": {7 "amount": "231.95",8 "currencyCode": "USD"9 }10 },11 "totalPriceSet": {12 "presentmentMoney": {13 "amount": "231.95",14 "currencyCode": "USD"15 }16 }17 },18 "userErrors": []19 }20}