Commercetools cart lineitem inventory update

278 Views Asked by At

I am trying to read inventory from the lineitems in cart, but inventory is not updated at lineitem. Is there any way to read updated inventory of lineitem without recalucate cart action?

1

There are 1 best solutions below

0
Jenny On

As stated in our documentation the availability field on line item variant of a cart might not contain the latest inventory state: "The availability is set if the variant is tracked by the inventory. The field might not contain the latest inventory state (it is eventually consistent) and can be used as an optimization to reduce calls to the inventory service."

If you want a current number of inventory, please query the inventory endpoint directly.

Also please note that the cart data is stale data and not updated automatically. As you suggested most data is only updated with a recalculate action.