Skip to content

ItemStockState ​

Type: schema

Description ​

The item's stock after the change, for seller and marketplace items alike: one line per warehouse and lot batch. Missing inventory settings are null; they do not imply defaults.

TypeScript Definition ​

typescript
ItemStockState: {{
            /** @description The variant, when the stock is a variant's; null for a product without variants. */
            variant_id: string | null;
            /** @description `null` for products without variants. */
            variant_name: $Read<string | null>;
            /** @description The product whose stock this is. */
            product_id: $Read<string>;
            /** @description The product's name. */
            product_name: $Read<string>;
            /** @description Null when this item has no inventory settings. */
            track_quantity: boolean | null;
            /** @description Null when this item has no inventory settings. */
            track_lot_batch: boolean | null;
            /** @description Null when this item has no inventory settings. */
            allow_backorder: boolean | null;
            /** @description Null when this item has no inventory settings. */
            low_stock_threshold: $Read<number | null>;
            /** @description Whether the item can be sold now. */
            stock_available: $Read<boolean>;
            /** @description One line per warehouse and lot batch. */
            stock: {
                sku?: $Read<string | null>;
                /** @description The warehouse recorded in this store configuration, or null if its details are unavailable. */
                warehouse?: {
                    id?: string | null;
                    name?: string | null;
                    gstin?: string | null;
                    city?: string | null;
                    address_line1?: string | null;
                    address_line2?: string | null;
                    landmark?: string | null;
                    pincode?: string | null;
                    state?: string | null;
                    contact_phone?: string | null;
                    contact_email?: string | null;
                    is_default?: boolean | null;
                } | null;
                /** Format: date */
                opening_stock_date?: string | null;
                warehouse_id: string;
                warehouse_name?: $Read<string | null>;
                received_quantity?: $Read<number>;
                reserved_quantity?: $Read<number>;
                sold_quantity?: $Read<number>;
                adjusted_quantity?: $Read<number>;
                /** @description Available stock quantity. */
                stock_quantity: number;
                lot_batch?: string | null;
                /** Format: date */
                mfg_date?: string | null;
                /** Format: date */
                exp_date?: string | null;
                manufacturer?: string | null;
                /** Format: date-time */
                created_at?: $Read<string>;
                /** Format: date-time */
                modified_at?: $Read<string>;
            }[];
            /** @description The seller item's marketplace listings, including when it has no inventory settings. Empty for a marketplace copy. */
            marketplace_listing: components["schemas"]["ItemMarketplaceListing"][];
            /** @description What this change did to the stock. */
            activities: components["schemas"]["StockActivity"][];
            /** @description The item in the marketplace store, when this stock belongs to a marketplace copy. */
            item_id?: string;
            /** @description An admin has marked this item out of stock until it is explicitly stocked in again. */
            manual_stock_out?: boolean;
            /** @description The original seller and catalog item, when this stock belongs to a marketplace copy. */
            seller?: {
                store_id: string | null;
                product_id: string | null;
                variant_id: string | null;
            };
            source_version: components["schemas"]["SourceVersion"];
        };
        /** KycDocument */
}

Component References ​

ReferenceResolves To
components["schemas"]["ItemMarketplaceListing"]ItemMarketplaceListing
components["schemas"]["StockActivity"]StockActivity
components["schemas"]["SourceVersion"]SourceVersion

OpenAPI Schema ​

json
{
  "title": "ItemStockState",
  "description": "The item's stock after the change, for seller and marketplace items alike: one line per warehouse and lot batch. Missing inventory settings are null; they do not imply defaults.",
  "type": "object",
  "externalDocs": {
    "url": "https://llm-docs.commercengine.io/storefront/schemas/ItemStockState",
    "description": "API reference for the ItemStockState schema"
  },
  "required": [
    "variant_id",
    "variant_name",
    "product_id",
    "product_name",
    "track_quantity",
    "track_lot_batch",
    "allow_backorder",
    "low_stock_threshold",
    "stock_available",
    "stock",
    "marketplace_listing",
    "activities",
    "source_version"
  ],
  "properties": {
    "variant_id": {
      "description": "The variant, when the stock is a variant's; null for a product without variants.",
      "type": [
        "string",
        "null"
      ]
    },
    "variant_name": {
      "description": "`null` for products without variants.",
      "type": [
        "string",
        "null"
      ],
      "readOnly": true
    },
    "product_id": {
      "description": "The product whose stock this is.",
      "type": "string",
      "readOnly": true
    },
    "product_name": {
      "description": "The product's name.",
      "type": "string",
      "readOnly": true
    },
    "track_quantity": {
      "description": "Null when this item has no inventory settings.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "track_lot_batch": {
      "description": "Null when this item has no inventory settings.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "allow_backorder": {
      "description": "Null when this item has no inventory settings.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "low_stock_threshold": {
      "description": "Null when this item has no inventory settings.",
      "type": [
        "number",
        "null"
      ],
      "readOnly": true
    },
    "stock_available": {
      "description": "Whether the item can be sold now.",
      "type": "boolean",
      "readOnly": true
    },
    "stock": {
      "description": "One line per warehouse and lot batch.",
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "warehouse_id",
          "stock_quantity"
        ],
        "properties": {
          "sku": {
            "type": [
              "string",
              "null"
            ],
            "readOnly": true
          },
          "warehouse": {
            "description": "The warehouse recorded in this store configuration, or null if its details are unavailable.",
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "gstin": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "address_line1": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "address_line2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "landmark": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "pincode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "state": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "contact_phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "contact_email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "is_default": {
                "type": [
                  "boolean",
                  "null"
                ]
              }
            }
          },
          "opening_stock_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "warehouse_id": {
            "type": "string"
          },
          "warehouse_name": {
            "type": [
              "string",
              "null"
            ],
            "readOnly": true
          },
          "received_quantity": {
            "type": "number",
            "readOnly": true
          },
          "reserved_quantity": {
            "type": "number",
            "readOnly": true
          },
          "sold_quantity": {
            "type": "number",
            "readOnly": true
          },
          "adjusted_quantity": {
            "type": "number",
            "readOnly": true
          },
          "stock_quantity": {
            "description": "Available stock quantity.",
            "type": "number"
          },
          "lot_batch": {
            "type": [
              "string",
              "null"
            ]
          },
          "mfg_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "exp_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "manufacturer": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "modified_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        }
      }
    },
    "marketplace_listing": {
      "description": "The seller item's marketplace listings, including when it has no inventory settings. Empty for a marketplace copy.",
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/ItemMarketplaceListing"
      }
    },
    "activities": {
      "description": "What this change did to the stock.",
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/StockActivity"
      }
    },
    "item_id": {
      "description": "The item in the marketplace store, when this stock belongs to a marketplace copy.",
      "type": "string"
    },
    "manual_stock_out": {
      "description": "An admin has marked this item out of stock until it is explicitly stocked in again.",
      "type": "boolean"
    },
    "seller": {
      "description": "The original seller and catalog item, when this stock belongs to a marketplace copy.",
      "type": "object",
      "properties": {
        "store_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "product_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "variant_id": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "store_id",
        "product_id",
        "variant_id"
      ]
    },
    "source_version": {
      "$ref": "#/components/schemas/SourceVersion"
    }
  }
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: