Backend API
Create a new stock adjustment. Normally, stock adjustments are automatically created when stock tracking is enabled and orders are placed or canceled.
Arguments
parent_idobjectIdrequired
The id of the parent product.
quantityintrequired
Quantity of the adjustment. A positive number means the stock was increased, and a negative number means the stock was decreased.
reasonstring
Enumerated reason for the stock adjustment. Can be received, returned, canceled, sold, missing, or damaged.
reason_messagestring
A brief description of the reason for the stock adjustment.
order_idobjectId
The id of an order when the stock adjustment was either reduced by the sale of a product or increased by canceling an order. Adjustments from orders are created automatically when stock tracking is enabled.
variant_idobjectId
The id of the parent variant, if applicable.
POST/products:stock
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.post('/products:stock', {
parent_id: '5ca24abb9c077817e5fe2b3b',
quantity: 10,
reason: 'received',
reason_message: 'Restock - PO #47362',
});
Response
{
"id": "5ca24abb9c077817e5fe2b3b",
"parent_id": "5ca7d6c68f749692da37c985",
"quantity": 10,
"level": 10,
"number": "100184",
"reason": "received"
"reason_message": "Restock - PO #47362",
"date_created": "2019-04-01T00:00:00.000Z"
}