Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1465000

Browse files
authored
Merge pull request magento#7583 from magento/kh_simplify-inv-rest
Simplify inventory REST tutorial
2 parents 3f7ef2c + cc25a5f commit 1465000

14 files changed

+466
-518
lines changed

src/guides/v2.4/rest/tutorials/inventory/assign-source-to-stock.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ In this example, we configure the Northeast warehouse to be the primary source f
3030

3131
**Endpoint:**
3232

33-
`POST <host>/rest/all/V1/inventory/stock-source-links`
33+
`POST <host>/rest/default/V1/inventory/stock-source-links`
3434

3535
**Scope:**
3636

37-
`all` store views
37+
`default` store views
3838

3939
**Headers:**
4040

@@ -53,44 +53,39 @@ In this example, we configure the Northeast warehouse to be the primary source f
5353
"priority" : 1
5454
},
5555
{
56-
"source_code" : "brooklyn",
56+
"source_code" : "west_wh",
5757
"stock_id" : 2,
5858
"priority" : 2
5959
},
6060
{
61-
"source_code" : "manhattan",
61+
"source_code" : "brooklyn",
6262
"stock_id" : 2,
6363
"priority" : 3
6464
},
6565
{
66-
"source_code" : "huntington",
66+
"source_code" : "manhattan",
6767
"stock_id" : 2,
68-
"priority": 4
68+
"priority" : 4
6969
},
7070
{
71-
"source_code" : "hq",
71+
"source_code" : "huntington",
7272
"stock_id" : 2,
73-
"priority" : 5
73+
"priority": 5
7474
},
7575
{
76-
"source_code" : "de_wh",
77-
"stock_id" : 3,
78-
"priority" : 1
79-
},
80-
{
81-
"source_code" : "berlin",
82-
"stock_id" : 3,
83-
"priority" : 2
76+
"source_code" : "berkeley",
77+
"stock_id" : 2,
78+
"priority" : 6
8479
},
8580
{
86-
"source_code" : "frankfurt",
87-
"stock_id" : 3,
88-
"priority" : 3
81+
"source_code" : "sausalito",
82+
"stock_id" : 2,
83+
"priority" : 7
8984
},
9085
{
91-
"source_code" : "hq",
92-
"stock_id" : 3,
93-
"priority" : 4
86+
"source_code" : "hq",
87+
"stock_id" : 2,
88+
"priority" : 8
9489
}
9590
]
9691
}
@@ -99,6 +94,7 @@ In this example, we configure the Northeast warehouse to be the primary source f
9994
**Response:**
10095

10196
Magento returns empty array.
97+
10298
[]
10399

104100
## Reindex and flush cache

src/guides/v2.4/rest/tutorials/inventory/bulk-transfer-products.md

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ functional_areas:
1313
- Integration
1414
---
1515

16-
The Voyage Yoga Bags (`24-WB01`) have sold well in the United States, but not in Europe. The Northeast warehouse is out of stock, and the Brooklyn store is running low. In this step, we'll bulk transfer all of the stock from the Leipzig warehouse for this product to the Northeast warehouse, and all of the stock from the Frankfurt store to Brooklyn. As a result, the product cannot be shipped from either of these European sources.
16+
The Northeast warehouse is out of stock of Voyage Yoga Bags (`24-WB01`). In this step, we'll bulk transfer all of the stock from the Huntington store to the Northeast warehouse. As a result, the product cannot be shipped from that store. We will also transfer five bags from the Sausalito store to the West warehouse.
1717

1818
In this scenario, there are no pending orders that contain the product, nor is the product on back-order. In production, make sure that you fulfill any pending orders before you bulk transfer a product. You might want to remove the product from the European website before performing the bulk transfer.
1919

20-
## Bulk transfer the product from Leipzig to Northeast
20+
## Bulk transfer the product from the Huntington store to the Northeast warehouse
2121

2222
The `POST /V1/inventory/bulk-product-source-transfer` endpoint allows you to specify an array of SKUs to bulk transfer from one source to another, but this example includes only one SKU. If you set the `unassignFromOrigin` attribute to `true`, the origin source is no longer associated with the specified products. If the attribute is `false`, Magento designates the products as being out of stock at the origin source with a quantity of 0.
2323

2424
**Endpoint:**
2525

26-
`POST <host>/rest/all/V1/inventory/bulk-product-source-transfer`
26+
`POST <host>/rest/default/V1/inventory/bulk-product-source-transfer`
2727

2828
**Scope:**
2929

30-
`all` store views
30+
`default` store view
3131

3232
**Headers:**
3333

@@ -42,41 +42,55 @@ The `POST /V1/inventory/bulk-product-source-transfer` endpoint allows you to spe
4242
"skus": [
4343
"24-WB01"
4444
],
45-
"originSource": "de_wh",
45+
"originSource": "huntington",
4646
"destinationSource": "ne_wh",
47-
"unassignFromOrigin": true
47+
"unassignFromOrigin": false
4848
}
4949
```
5050

5151
**Response:**
5252

5353
`true`
5454

55-
## Bulk transfer the product from Frankfurt to Brooklyn
55+
## Partially transfer the product from Sausalito to the West warehouse
5656

57-
Use the same endpoint to bulk transfer the product to Brooklyn.
57+
Use the `bulk-partial-source-transfer endpoint` to transfer a portion of in-stock units from one source to another.
58+
59+
**Endpoint:**
60+
61+
`POST <host>/rest/default/V1/inventory/bulk-partial-source-transfer`
62+
63+
**Scope:**
64+
65+
`default` store view
66+
67+
**Headers:**
68+
69+
`Content-Type`: `application/json`
70+
71+
`Authorization`: `Bearer <admin_token>`
5872

5973
**Payload:**
6074

6175
```json
6276
{
63-
"skus": [
64-
"24-WB01"
65-
],
66-
"originSource": "frankfurt",
67-
"destinationSource": "brooklyn",
68-
"unassignFromOrigin": true
77+
"originSourceCode": "sausalito",
78+
"destinationSourceCode": "west_wh",
79+
"items": [
80+
{
81+
"sku": "24-WB01",
82+
"qty": 5
83+
}
84+
]
6985
}
7086
```
7187

7288
**Response:**
7389

74-
`true`
90+
An empty array.
7591

76-
## Verify this step
92+
[]
7793

78-
In Admin, click **Catalog** > **Products**. Scroll down to the Driven Backpack row.
94+
## Verify this step
7995

80-
* The stock has been transferred from Berlin to Baltimore. The Baltimore warehouse now has 32 units.
81-
* The Austin warehouse now has 7 units.
82-
* The **Salable Quantity** column no longer lists European stock.
96+
In Admin, click **Catalog** > **Products**. Scroll down to the Driven Backpack row and note the new quantities.

src/guides/v2.4/rest/tutorials/inventory/configure-environment.md

Lines changed: 9 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -15,86 +15,6 @@ functional_areas:
1515

1616
This step guides you through the process of configuring your Magento instance so that you can perform the Order Processing with Inventory Management tutorial.
1717

18-
## Create two websites
19-
20-
**Sales Channels** are entities from which you sell inventory. You can set up Magento websites to be sales channels, and Magento supports extensions for creating other types of channels.
21-
22-
In this tutorial, we'll create the infrastructure needed to implement a US and a German store.
23-
24-
### Create the North America website
25-
26-
1. Log in to Admin and select **Stores** > Settings > **All Stores**. Click **Create Website**, then assign the following values:
27-
28-
Field | Value
29-
--- | ---
30-
Name | North America Site
31-
Code | `na_site`
32-
33-
Click **Save Web Site**.
34-
35-
1. Click **Create Store** and assign the following values:
36-
37-
Field | Value
38-
--- | ---
39-
Web Site | North America Site
40-
Name | North America Store
41-
Code | `na_store`
42-
Root Category | Default Category
43-
44-
Click **Save Store**.
45-
46-
1. Click **Create Store View** and assign the following values:
47-
48-
Field | Value
49-
--- | ---
50-
Store | US Store
51-
Name | US Store View
52-
Code | `us`
53-
Status | Enabled
54-
55-
Click **Save Store View**.
56-
57-
### Create the Europe website
58-
59-
1. Select **Stores** > Settings > **All Stores** and click the **Create Website** button. Assign the following values:
60-
61-
Field | Value
62-
--- | ---
63-
Name | Europe Site
64-
Code | `eu_site`
65-
66-
Click **Save Web Site**.
67-
68-
1. Click **Create Store** and assign the following values:
69-
70-
Field | Value
71-
--- | ---
72-
Web Site | Europe Site
73-
Name | Europe Store
74-
Code | `eu_store`
75-
Root Category | Default Category
76-
77-
Click **Save Store**.
78-
79-
1. Click **Create Store View** and assign the following values:
80-
81-
Field | Value
82-
--- | ---
83-
Store | Europe Store
84-
Name | Germany Store View
85-
Code | `de`
86-
Status | Enabled
87-
88-
Click **Save Store View**.
89-
90-
## Configure website URLs (Optional)
91-
92-
To make it easier to locate products and log in as a customer later in this tutorial, configure Magento to add the store code to the URL.
93-
94-
1. Click **Stores** > Settings > **Configuration** > **General** > **Web** and expand the **Url Options** section.
95-
1. Change the value of **Add Store Code to Urls** to **Yes**.
96-
1. Click **Save Config**.
97-
9818
## Configure payment and delivery methods
9919

10020
For this tutorial, we'll assume that payment and delivery methods are configured globally. You can also make configuration changes at the website or store view level.
@@ -107,12 +27,18 @@ For this tutorial, we'll assume that payment and delivery methods are configured
10727

10828
{% include webapi/tutorials/configure-shipping-methods-24.md %}
10929

110-
## Reindex and flush the cache
30+
## Deactivate a cart price rule
31+
32+
By default, the Luma store includes a promotion where shipping is free if you spend at least $50. Since this tutorial shows shipping calculations, we need to deactivate this promotion. The promotion is defined in a cart price rule, which is also known as a sales rule. When you deactivate the cart price rule, shipping is charged at a flat rate of $5 per item.
33+
34+
To disable this cart price rule, select **Marketing** > Promotions > **Cart Price Rules**. Then edit rule ID 2 (Spend $50 or more - shipping is free!), and toggle the Active switch to No. Be sure to save the change.
35+
36+
## Flush the cache
11137

112-
**Required:** Perform a full reindex and flush the cache.
38+
Run the following command to cache the changes in configuration.
11339

11440
```bash
115-
bin/magento indexer:reindex && bin/magento cache:flush
41+
bin/magento cache:flush
11642
```
11743

11844
## Verify this step

0 commit comments

Comments
 (0)