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
1{
2 "stock": {
3 "name": "US Stock",
4 "extension_attributes": {
5 "sales_channels": [
6 {
7 "type": "website",
8 "code": "base"
9 }
10 ]
11 }
12 }
13}

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 my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.