Edit in GitHubLog an issue

Step 3. Create stocks

This step guides through the process for creating stock. Stock represents a virtual, aggregated inventory of products for sources of your sales channels. Each stock maps sales channels with sources to determine available inventories and salable quantities.

A sales channel can only be assigned to one stock.

The stock_id of the default stock is 1. You cannot delete or add sources to the default stock, but you can perform these actions with custom stocks.

For more information about stock, see Inventory Management overview.

Create the stock

The POST V1/inventory/stocks endpoint creates a stock. The name, type, and code attributes are required. The code value cannot be changed.

Endpoint:

POST <host>/rest/default/V1/inventory/stocks

Scope:

default store view

Headers:

Content-Type: application/json

Authorization: Bearer <admin_token>

Payload:

The name attribute is required.

Copied to your clipboard
{
"stock": {
"name": "US Stock",
"extension_attributes": {
"sales_channels": [
{
"type": "website",
"code": "base"
}
]
}
}
}

Response:

Commerce returnsthe stock_id, such as 2. The value will be used in subsequent steps.

Verify this step

In Admin, click Stores > Inventory > Stocks. The new stocks are displayed in the Stock grid.

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.