Change how many of a variant a bundle contains
Authorizations
A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.
Headers
A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.
Body
THE COMPONENT IS ADDRESSED BY ITS VARIANT ID, never by the component row's own id, because (bundle, variant) is the real natural key and nothing on this platform addresses a component any other way. It also matches what the read publishes, so this URL is built from the items array a client already holds. QUANTITY IS THE ONLY WRITABLE FIELD and it is REQUIRED, so this route has no empty patch to refuse. variant_id is refused BY NAME: swapping which product is in a bundle would silently repoint the component and, because the set price is allocated across whatever components exist, change what every other one is worth per unit. A swap is a remove plus an add, and the remove is not published here at all. CHANGING A QUANTITY RE-DIVIDES THE SAME SET PRICE. The bundle's price_minor does not move, so raising one component's quantity lowers what every other component is worth per unit at checkout and the shopper still pays the same total. It takes effect at the next cart recompute, because a bundle is resolved when a cart is priced rather than snapshotted. IT IS NOT AN UPSERT. A variant that is not already a component answers 404 item_not_found, never an implicit insert, because a client that meant to add one asked the wrong route and a typo in the URL would otherwise quietly enlarge the bundle. The two 404s this route can answer carry different codes (not_found for the bundle, item_not_found for the component) so a client can tell which half of the URL was wrong. IT CONVERGES: quantity is absolute, so a replay with a fresh key sets the same component to the same number. No stock moves and no money moves, and nothing is emitted. The response is the WHOLE bundle, for the add route's reasons. bundle_id, price, price_minor and the provenance keys (id, store_id, created_at, updated_at) are refused BY NAME. No key may be null.
Required. How many of the variant named in the path ONE bundle contains. There is no way to say zero: the column refuses it, and removing a component is not published on this API.
1 <= x <= 1000000Response
Success
