Hi Shopify Community!
I using the orderCreate mutation to create an order. I set options.inventoryBehaviour equal DECREMENT_OBEYING_POLICY and checked Track quantity for product, but the product’s inventory quantity does not decrease after successfully creating the order.
Thanks in advance for your help!
Hi Levi,
Can you post your full mutation? The issue you’re encountering with the orderCreate
mutation and the inventoryBehaviour: DECREMENT_OBEYING_POLICY
not decrementing inventory could be due to several factors:
- Inventory Policy: The
DECREMENT_OBEYING_POLICY
option respects the product’s inventory policy. If the product’s inventory policy does not allow inventory to be decremented (e.g., the product is set to “Do not track inventory”), the inventory will not decrease. Ensure that the product is set to “Track quantity” and has sufficient available inventory. - Inventory Location: The inventory decrement will only occur if the product is stocked at a location that is associated with the order’s fulfillment. If the product is not stocked at the location specified in the order, the inventory will not be decremented.
- Inventory State: Shopify’s inventory system has different states, such as
available
,committed
, andon_hand
. Thecommitted
state is specifically affected by order creation and fulfillment. Ensure that the inventory is in the correct state to be decremented.
Hi @Liam-Shopify,
I send mutation and parameters:
{
"query" : "mutation orderCreate($order: OrderCreateOrderInput!) {\r\n orderCreate(\r\n order: $order\r\n options: {sendReceipt: true, sendFulfillmentReceipt: true}\r\n ) {\r\n userErrors {\r\n field\r\n message\r\n }\r\n order {\r\n id\r\n name\r\n statusPageUrl\r\n discountCodes\r\n createdAt\r\n customer {\r\n id\r\n }\r\n }\r\n }\r\n}",
"variables" : {
"options" : {
"inventoryBehaviour" : "DECREMENT_OBEYING_POLICY"
},
"order" : {
"buyerAcceptsMarketing" : true,
"currency" : "VND",
"billingAddress" : {
"firstName" : "DEMO",
"lastName" : "12",
"phone" : "0912383812",
"address1" : "Sar-e Pol",
"city" : "Sp",
"countryCode" : "AF",
"zip" : "60000"
},
"email" : "demo12@gmail.com",
"shippingAddress" : {
"firstName" : "DEMO",
"lastName" : "12",
"phone" : "0912383812",
"address1" : "Sar-e Pol",
"city" : "Sp",
"countryCode" : "AF",
"zip" : "60000"
},
"note" : "",
"lineItems" : [ {
"quantity" : 1,
"productId" : "gid://shopify/Product/8567950639278",
"priceSet" : {
"shopMoney" : {
"amount" : 50.0,
"currencyCode" : "VND"
}
},
"variantId" : "gid://shopify/ProductVariant/45729290485934",
"properties" : [ {
"name" : "_meta",
"value" : "elise-test-3.myshopify.com_true_demo12@gmail.com"
} ],
"requiresShipping" : true
}, {
"quantity" : 1,
"title" : "COD Fee",
"priceSet" : {
"shopMoney" : {
"amount" : 10.0,
"currencyCode" : "VND"
}
},
"taxable" : false,
"requiresShipping" : true
} ],
"financialStatus" : "PENDING",
"shippingLines" : [ {
"priceSet" : {
"presentmentMoney" : {
"amount" : 0.0,
"currencyCode" : "VND"
},
"shopMoney" : {
"amount" : 0.0,
"currencyCode" : "VND"
}
},
"title" : "Free shipping"
} ],
"sourceName" : "Online store",
"tags" : [ "mt_cod_form" ],
"customAttributes" : [ {
"key" : "FirstName",
"value" : "DEMO"
}, {
"key" : "LastName",
"value" : "12"
}, {
"key" : "PhoneNumber",
"value" : ""
}, {
"key" : "AlternativePhoneNumber",
"value" : ""
}, {
"key" : "Email",
"value" : "demo12@gmail.com"
}, {
"key" : "Country",
"value" : "AF"
}, {
"key" : "State",
"value" : "Sar-e Pol"
}, {
"key" : "City",
"value" : "Sp"
}, {
"key" : "Zipcode",
"value" : "60000"
}, {
"key" : "ShippingAddress",
"value" : "Sar-e Pol"
}, {
"key" : "ShippingNote",
"value" : ""
}, {
"key" : "IP address",
"value" : "::1"
}, {
"key" : "Device type",
"value" : "Desktop"
} ],
"customer" : {
"toUpsert" : {
"addresses" : [ {
"firstName" : "DEMO",
"lastName" : "12",
"phone" : "0912383812",
"address1" : "Sar-e Pol",
"city" : "Sp",
"country" : "AF",
"zip" : "60000"
} ],
"firstName" : "DEMO",
"lastName" : "12",
"email" : "demo12@gmail.com",
"id" : "gid://shopify/Customer/7626202644654"
}
},
"transactions" : [ {
"gateway" : "Cash on Delivery (COD)",
"kind" : "SALE",
"amountSet" : {
"shopMoney" : {
"amount" : 60.0,
"currencyCode" : "VND"
},
"presentmentMoney" : {
"amount" : 60.0,
"currencyCode" : "VND"
}
},
"status" : "PENDING"
} ]
}
}
}
I set track quantity for variant.
I look forward to receiving your feedback. Thank you!