Manage inventory for in-store pick up

By default, Commerce maintains one set of inventory values for each product or SKU, however, to configure in-store pick up you must maintain multiple inventory locations so that you can provide inventory information to shoppers.

This section describes changes to the endpoints that allow you to implement in-store pick up. For detailed information about the procedures in this section, as well as examples for updating and working with inventory for a specific location, see Manage Multiple Inventory Locations.

To maintain inventory for individual physical stores or web sites, you must represent them in Commerce by creating new locations. Use the createLocation endpoint to create a new physical location. You specify information about the location in the body of the request. To allow in-store pick up at a physical location, set its pickUp property to true. You must set pickup to true even if you do not plan to have goods in stock at this location, but will have them shipped there from an online inventory location or warehouse.

The following example creates a brick-and-mortar store where shoppers can pick up their purchases:

POST /ccadmin/v1/locations HTTP 1.1
Authorization: Bearer <access_token>

{
  "externalLocationId": "107",
  "locationId": "Cambridge02",
  "pickup": true,
  "address1": "221 Third Street",
  "country": "USA",
  "city": "Cambridge",
  "faxNumber": "(617) 386-1200",
  "postalCode": "02141",
  "phoneNumber": "(617) 386-1200",
  "email": "cmb02@example.com",
  "stateAddress": "MA",
  "county": "Middlesex",
  "name": "Cambridge, MA -- 02141",
  "longitude": -71.0901,
  "latitude": 42.3629
}

See Create locations for more details about creating and working with physical locations, including information about how to configure location inventory in an environment that supports multiple sites.

Before you can create an inventory location for your site, you must create or update a site to use the inventoryLocationId property. Use the site endpoint to set a default inventory location ID for a custom site that contains the inventoryLocationId. For example:

When you create a new inventory location, it initially has no inventory data associated with it. You can use the createInventory endpoint to set inventory values for a specific SKU at the location. For example, the following request specifies inventory data for the location created in the previous section:

POST /ccadmin/v1/inventories HTTP 1.1
Authorization: Bearer <access_token>

{
  "locationId": "Cambridge02",
  "id": "xsku5014",
  "stockThreshold": 10,
  "stockLevel": 75
}

See Create inventory data for locations for more details about adding and working with inventory for physical locations

You can also import inventory data for a location, specified by its locationId. See Export and import inventory data for more information.