Is inventory_behaviour working properly for REST Order Create API?

Topic summary

Issue: Inventory was not decreasing when creating orders via the REST API using the inventory_behaviour parameter.

Key findings and fixes:

  • Spelling matters: use inventory_behaviour (British spelling), not inventory_behavior. Several failures were due to the misspelling.
  • Use variant_id, not product_id, in line_items. Inventory is tracked at the variant level.
  • Ensure the product/variant has “Track quantity” enabled.

Expected behavior:

  • inventory_behaviour: decrement_obeying_policy decrements stock only if inventory is available (respecting the store’s oversell policy). If out of stock and overselling is not allowed, the API returns errors: { “line_items”: [“Unable to reserve inventory”] }.
  • With sufficient stock (or oversell allowed), orders create successfully and inventory is decremented.

Support/debugging:

  • Shopify staff requested X-Request-Id headers to trace problematic requests and identified product_id usage as a root cause in one case.

Current status:

  • Multiple reporters confirmed resolution after correcting spelling and sending a valid variant_id; inventory now decrements correctly.
  • A later post still reports quantities not decreasing/committed not updating, but it likely uses the American spelling. No platform bug confirmed; unresolved cases need request IDs for investigation.

Notes: The shared JSON payloads are central to understanding the issue and resolution.

Summarized with AI on December 26. AI used: gpt-5.

Hey Sean,

The problem is that you are passing in a product_id for the order line_items instead of a variant_id. Since inventory is tied to variants, you need to specify the variant_id in order for the inventory behaviour to execute properly.

2 Likes