Read inventory levels in cart validations

Hello there,

By reading the docs, there seems to be no way to read information about the current inventory levels of products in the cart, within a cart validation.

I’m referring to the product’s “out of stock policy” state (continue selling when out of stock) and available stock items remaining.

This sounds bizarre, because that’s one of the things that Shopify itself is validating
when people add stuff to the cart.

Am I missing something, or is this the expected behavior for some reason?

For context, we are trying to limit the backorderable quantities to a specific threshold, driven by a metafield on the product. Is there any better way to solve this?

You are not missing anything. We don’t currently expose that level of information in the data available to Cart and Checkout Validation Functions.

The approach you’ve taken, using metafields to annotate the products with additional data, sounds like a good approach.