Product Stock
Administrative endpoints for product stock — the primary on-hand quantity of a product in the catalog. There is exactly one product-stock record per product (product is a one-to-one reference), holding the sellable stock count, the unit of measure, and a counter used to reconcile stock reported by an external system (ERP) against quantities already sold locally.
Additional per-seller stock (one record per stock list / data source) is managed separately through the extra_product_stock endpoints.
Core Capabilities
1. Listing & Filtering
Retrieve a paginated list of product-stock records.
Filter by product (including nested product filters) and by modification date.
Order results with the
sortparameter, as described under Filtering & Ordering.
2. Full CRUD
Create a stock record for a product.
Retrieve a single record.
Fully or partially update a record.
Delete a record.
DELETEis a soft delete — the row is kept and itsstockis set to0.
3. Bulk Upsert
Create or update many records in one request through
POST /product_stock/bulk_upsert/.
Product Stock Fields
pk
integer
The unique identifier of the record. Read-only; supplying it in a request body has no effect.
product
integer
The identifier of the product this stock belongs to. Required on create. One record per product; the product cannot be changed on update.
stock
integer
The sellable quantity. A non-negative integer; defaults to 0.
unit_type
string
The unit of measure — qty (quantity) or kg (kilogram). Defaults to qty.
extra_field
object
Free-form JSON for extra data. Optional; defaults to an empty object.
sold_quantity_unreported
integer
The quantity sold locally but not yet reflected in the externally reported stock. A non-negative integer; normally managed internally. See Stock Reconciliation.
modified_date
string
Read-only. ISO 8601 timestamp of the last modification.
Stock Reconciliation
When stock is written for a product, the incoming quantity is reconciled against what has already been sold locally: the stored stock becomes max(incoming_stock - sold_quantity_unreported, 0). This keeps a feed of ERP-reported stock from overselling items that have already left the shelf but have not yet been reported back to the ERP.
Deleting a Product Stock
Important:
DELETEnever removes the record. Itsstockis set to0and the row is kept, so the product simply becomes out of stock and can be restocked with a later update.
Filtering & Ordering
The list endpoint accepts these filters:
product
The related product by identifier.
product__id, product__sku, product__base_code, product__product_type, …
Nested product filters — any filter exposed by the product filter set, addressed with the product__ prefix.
modified_date__gt, modified_date__gte, modified_date__lt, modified_date__lte
Modification-date range comparisons (ISO 8601).
There is no plain modified_date equality filter. Results can be ordered with the sort parameter on the record's fields (e.g. -modified_date); prefix a field with a hyphen for descending order.
Dynamic Settings & Environment Variables
The write endpoints are affected by one dynamic setting.
LIST_SIMPLE_INSTEAD_OF_META
boolean
false
When true, writing stock for a simple-type product (via create, update, or bulk upsert) triggers a recomputation of that product's listable status after the stock is saved, so a product that just went in or out of stock is re-evaluated for storefront listing. It does not change any request or response field, and it has no effect on read operations or on non-simple products.
Environment variables: No environment variables are read directly by these endpoints. The default of LIST_SIMPLE_INSTEAD_OF_META is taken from the Django setting of the same name (falling back to false).
Last updated
Was this helpful?

