Increasing count_on_hand for products (or variants, not sure) via API

Hi Marlin,

That looks like you’re starting from the right place. The one to look for is the PUT on the variant, not the product, since the product’s count_on_hand value is a cached version of that stored on the variant(s).

There’s an additional layer of complexity here because of VariantOverrides, which allow a hub to have their own stock level of a variant, independent of the stock level at the producer or at other hubs. There’s a little documentation of variant overrides at this page: Variant Overrides - Hub can override stock level and price on a variant . (@Kirsten, do you know of any more thorough documentation?)

I doubt that’s causing your immediate problem though. If I were to investigate this problem myself, I’d start by putting a binding.pry in the spree API, in Spree::Api::VariantsController#update and investigate whether authorisation was granted, if the save succeeded and so on.

Hope this helps,
Rohan