Sitecore OrderCloud Documentation

docs

Portal Login

Multi-Location Inventory

Published by Miranda Posthumus on January 4, 2022

Last updated on March 1, 2024

New feature to allow tracking of product inventory across multiple locations. Updated in April 2023 to include the option to limit shopper access to inventory at specific locations by using granular assignments.

New Resource: InventoryRecord

"InventoryRecord" : {
  "ID": "",
  "OwnerID": "",
  "AddressID": "",
  "Address": {...}, //read-only Address object
  "OrderCanExceed": false,
  "QuantityAvailable": 0,
  "LastUpdated": "2022-01-04T00:00:00.00+00:00",
  "AllowAllBuyers": true, 
  "xp": {}
}

Optionally used in conjunction with InventoryRecordAssignment

"InventoryRecordAssignment": {
   "InventoryRecordID": "",
   "BuyerID": "",
   "UserGroupID": ""
}


The InventoryRecord resource exists only in the context of a given Product, and can be extended to Product Variants.

  • The ID property is writable and follows the same convention as all other writable IDs in OrderCloud.

  • The OwnerID property is writable only by the Marketplace Owner. Otherwise this ID reflects the Supplier that created the Inventory Record.

  • The Product.Inventory object will remain on the Product resource, even if Inventory Records are associated with the given Product.

    • If any InventoryRecords exist for a product, Product.Inventory.QuantityAvailable will be the derived sum of all InventoryRecord.QuantityAvailable. If you write to it, the value will never be returned unless all InventoryRecords are deleted.

  • Address is a read-only object derived from the AddressID given.

  • Multiple InventoryRecords for the same Product/Address combination are allowed. This can be useful if you need to track different inventory levels for different fulfillment methods.

  • The AddressID used to create an InventoryRecord must be owned by the OwnerID.

  • AllowAllBuyers defaults to true. If you want to control Inventory Records more granularly, set this value to false and use assignments.

  • InventoryRecords are not returned on the Product resource; however, you can filter on certain InventoryRecord information in product queries, e.g. v1/me/products?InventoryRecords.AddressID={address1}|{address2}&InventoryRecords.QuantityAvailable=>5.

    • Filtering products on InventoryRecords is only supported in marketplaces not using InventoryRecordAssignments. If your marketplace uses assignments, the filters will likely return unexpected results.

    • Properties that can be filtered on when querying for products are:

      • ID

      • OwnerID

      • AddressID

      • QuantityAvailable

      • Zip (corresponding to Address.Zip on the InventoryRecord)

New Endpoints

Products

  • GET v1/products/{productID}/inventoryrecords

  • GET v1/products/{productID}/inventoryrecords/{inventoryRecordID}

  • POST v1/products/{productID}/inventoryrecords

  • PUT v1/products/{productID}/inventoryrecords/{inventoryRecordID}

  • PATCH v1/products/{productID}/inventoryrecords/{inventoryRecordID}

  • DELETE v1/products/{productID}/inventoryrecords/{inventoryRecordID}

  • GET v1/products/{productID}/inventoryrecords/assignments

  • POST v1/products/{productID}/inventoryrecords/assignments

  • DELETE v1/products/{productID}/inventoryrecords/{inventoryRecordID}/assignments

Variants

  • GET v1/products/{productID}/variants/{variantID}/inventoryrecords

  • GET v1/products/{productID}/variants/{variantID}/inventoryrecords/{inventoryRecordID}

  • POST v1/products/{productID}/variants/{variantID}/inventoryrecords

  • PUT v1/products/{productID}/variants/{variantID}/inventoryrecords/{inventoryRecordID}

  • PATCH v1/products/{productID}/variants/{variantID}/inventoryrecords/{inventoryRecordID}

  • DELETE v1/products/{productID}/variants/{variantID}/inventoryrecords/{inventoryRecordID}

  • GET v1/products/{productID}/variants/{variantID}/inventoryrecords/assignments

  • POST v1/products/{productID}/variants/{variantID}/inventoryrecords/assignments

  • DELETE v1/products/{productID}/variants/{variantID}/inventoryrecords/{inventoryRecordID}/assignments

Me

  • GET v1/me/products/{productID}/inventoryrecords

  • GET v1/me/products/{productID}/variants/{variantID}/inventoryrecords

New Properties

LineItem.InventoryRecordID

  • Only writable prior to submitting an order

  • References the InventoryRecord that will be decremented on submit.

  • If using Inventory Records for a given Product, you must provide an InventoryRecordID on the LineItem in order to track inventory. If any Inventory Records exist for a Product on a LineItem where InventoryRecordID is null, no inventory will be decremented on order submit.

OrderCalculateResponse.LineItemOverrides.InventoryRecordID

  • Allows an override of InventoryRecordID on a given LineItem

  • Not validated for AllowAllBuyers or explicit assignments

Configuring your Inventory Records

Use Case

There are three physical locations customers can choose from to pick up their order after buying online.

Administrative Workflow

  1. Create three InventoryRecords for each of your products using POST v1/products/{productID}/inventoryrecords

    1. Each should be associated with a unique address associated with the physical locations.

    2. Assignments aren't needed unless you want to limit certain shoppers to certain locations

    3. Set the QuantityAvailable at each location

Shopper Workflow 1

  1. Navigate to a product detail page after browsing products

  2. Call GET v1/me/products/{productID}/inventoryrecords?QuantityAvailable=>1 to view which locations that have the product in stock

  3. Add the product to my cart using POST v1/cart/lineitems making sure to include LineItem.InventoryRecordID in the request body

    1. Adding the reference to the InventoryRecord tells OrderCloud where to decrement the correct quantity from on submit

    2. You can optionally enforce that InventoryRecordID is present on every LineItem by using pre-webhooks if needed

Shopper Workflow 2

  1. Only browse products available at my preferred location using v1/me/products?InventoryRecords.AddressID={address1}&InventoryRecords.QuantityAvailable=>1

  2. Add the product to my cart using POST v1/cart/lineitems making sure to include LineItem.InventoryRecordID in the request body


Was this page helpful? Give it a bravo!

Still have questions?
Ask in our Community Channel

Content Powered By
Sitecore Logo

© Copyright 2024, Sitecore OrderCloud®. All rights reserved.

Contact Us
Privacy Policy
Sitecore