I am using the “currentlyNotInStock” field of the ProductVariant in the Storefront API to check the “backorder” inventory status of a product. However, I’ve noticed an issue with how this field behaves when inventory is not tracked:
- If “Continue selling when out of stock” is enabled and the product stock is 0 or less before enable “Inventory not tracked” for product, “currentlyNotInStock” returns true.
- If “Continue selling when out of stock” is disabled before, “currentlyNotInStock” returns false.
I believe that when inventory is not tracked, “currentlyNotInStock” should always return false. In this scenario, considering the product as “In stock” is more logical and accurate than categorizing it as “Backorder”.
Hi @Faris_Avada
This is expected behavior based on how currentlyNotInStock is calculated.
That field reflects sellable state vs available inventory not strictly whether inventory is tracked. If inventory was previously ≤ 0 and “continue selling when out of stock” was enabled, the variant can still be treated as not in stock but sellable (backorder logic), even after switching to “inventory not tracked.
When inventory is not tracked, Shopify does not automatically reset historical stock state so currentlyNotInStock may still return true.
If you need stricter logic, you should combine:
availableForSale
quantityAvailable
inventoryPolicy`
and inventory tracking status
instead of relying only oncurrentlyNotInStock.
@Faris_Avada
currentlyNotInStock is based on the variant’s previous inventory policy, not just whether inventory is tracked.
When inventory tracking is turned off, Shopify does not recalculate this field, so it may still return true or false depending on past settings.
Best
If inventoryItem.tracked == false, treat the product as in stock and ignore currentlyNotInStock.