The local inventory service allows you to create and update instances of the local inventory resource, which contain fields that can have different values for different physical store locations. Each local inventory instance is a child of an existing product resource, and inherits the product data fields from the parent resource. For example, you might have a product that has a different price and quantity in different stores, but shares an ID, description, and other product data across all stores. Local inventory data is used for the Local surfaces across Google and Local Inventory Ads programs.
This guide explains what you need before you start using the local inventory service, describes the available fields and methods, and provides an example of a service request.
Prerequisites
- In order to use the local inventory service, you must create a Business Profile, link your Business Profile to your Merchant Center account, verify your business, and set up your Business Profile store codes.
Your Merchant Center account must be enrolled in a local program: either Local surfaces across Google or Local inventory ads. For more information about using local inventory ads via the Content API, see Get Started with Local Inventory Ads.
The local inventory service creates local inventory instances for existing local products You must first create local products, using either the Content API products service or Merchant Center datafeeds, by setting the
channel
field tolocal
. You can then use the local inventory service to create local inventory instances for each Business Profilestorecode
where the product is sold.
Fields
Each local inventory instance contains a set of fields that is associated with a
specific store location via the storeCode
field (which you define in your
Business Profile). Only
storecode
and
productId
are required for all requests. All other fields are optional:
- Required for all requests:
storeCode
,productId
(in URL) - Optional:
quantity
,price
,salePrice
,salePriceEffectiveDate
,availability
,pickupMethod
,pickupSla
,instoreProductLocation
For a complete list of local inventory fields and their descriptions, see the localinventory reference page.
Methods
The local inventory service only includes two methods:
localinventory.insert
localinventory.insert
allows you to create a local inventory instance for a single local product.
This example demonstrates how to use the local inventory service to create an in-store sale from February 24th, 2021 at 1:00 pm (GMT-8) until February 28th, 2021 at 3:30pm (GMT-8). The request also updates the quantity available for the local inventory instance. Unlike supplemental feeds for non-local product data, fields that are not included in the body of the request are overwritten by this call:
POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId/localinventory
{
"storeCode": “1235”,
"salePrice": {
"value": “100.00”,
"currency": “USD”
},
"salePriceEffectiveDate": “2021-02-24T13:00-0800/2021-02-28T15:30-0800”,
"quantity": 200,
}
localinventory.custombatch
localinventory.custombatch
allows you to create multiple local inventory instances for a single
local product in multiple stores, or create local inventory instances for
multiple local products.