variant_stock_mode_change_blocked
A variant that keeps its own stock is being switched to sell from the stock of the product (`manage_stock` from `true` to `false`) while it still holds stock: switching would stop counting what is left, with no ledger movement to explain it. `param` is `manage_stock` and `subcode` names the cause: `has_own_stock` (its total balance is not zero), `has_warehouse_balances` (the total is zero but a warehouse keeps a non-zero balance; a +5 and a −5 add up to zero and are still two balances), `has_live_reservations` (it has held, unexpired reservations), `has_open_delivery_notes` (it has quantity committed on uncollected sales-order delivery notes) or `has_stock_in_transit` (it has quantity shipped by a transfer and not yet received). The opposite direction, from product stock to own stock, is only rejected with `has_live_reservations`, `has_open_delivery_notes` or `has_stock_in_transit`: what the variant set aside from the stock of the product while it sold from it would be served against its own balance, which starts at zero.
| Code | Type | HTTP | Category |
|---|---|---|---|
variant_stock_mode_change_blocked | invalid_request_error | 422 | Products |
Cause
A variant that keeps its own stock is being switched to sell from the stock of the product (manage_stock from true to false) while it still holds stock: switching would stop counting what is left, with no ledger movement to explain it. param is manage_stock and subcode names the cause: has_own_stock (its total balance is not zero), has_warehouse_balances (the total is zero but a warehouse keeps a non-zero balance; a +5 and a −5 add up to zero and are still two balances), has_live_reservations (it has held, unexpired reservations), has_open_delivery_notes (it has quantity committed on uncollected sales-order delivery notes) or has_stock_in_transit (it has quantity shipped by a transfer and not yet received). The opposite direction, from product stock to own stock, is only rejected with has_live_reservations, has_open_delivery_notes or has_stock_in_transit: what the variant set aside from the stock of the product while it sold from it would be served against its own balance, which starts at zero.
What to do
Bring the variant's own balance to zero in every warehouse (or move it with a transfer or a stock adjustment), release or serve its reservations, deliver or cancel the pending delivery notes and receive the transfers on their way. Then repeat the same request.