# Local inventory service

The local inventory service allows you to create and update instances of the
[local inventory resource](https://developers.google.com/shopping-content/reference/rest/v2.1/localinventory#resource:-localinventory),
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](https://developers.google.com/shopping-content/reference/rest/v2.1/products#resource:-product),
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](https://support.google.com/merchants/answer/9825611)
and [Local Inventory Ads](https://support.google.com/merchants/answer/3057972)
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.

> [!NOTE]
> **Note:** In v2.1 of the Content API, the local inventory service and supplemental feeds replace the inventory service in v2. To perform partial updates to non-local product data with API v2.1, use [supplemental feeds](https://developers.google.com/shopping-content/guides/products/supplemental-feeds). To make supplemental local product updates, use the [`localinventory`
> service](https://developers.google.com/shopping-content/guides/products/local-inventory).

## Prerequisites

- In order to use the local inventory service, you must [create a Business Profile](https://support.google.com/business/answer/6300717), [link your Business Profile to your Merchant Center account](https://developers.google.com/shopping-content/guides/how-tos/lia/link-gmb), [verify your business](https://support.google.com/business/answer/6300716), and [set up your Business Profile store codes](https://support.google.com/business/answer/4542487).
- 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](https://developers.google.com/shopping-content/guides/how-tos/lia/get-started).

  > [!NOTE]
  > **Note:** If your Merchant Center account is not enrolled in a local program, setting a product's `channel` field to `local`, via the [`Products.insert`](https://developers.google.com/shopping-content/reference/rest/v2.1/products/insert) method, results in the error: "<var translate="no">channel</var> Invalid channel: local".

- The local inventory service creates local inventory instances for existing
  local products You must first create local products, using either the Content
  API [products](https://developers.google.com/shopping-content/reference/rest/v2.1/products) service or
  Merchant Center [datafeeds](https://support.google.com/merchants/answer/7439882), by
  setting the `channel` field to `local`. You can then use the local inventory
  service to create local inventory instances for each Business Profile
  `storecode` 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`](https://developers.google.com/shopping-content/reference/rest/v2.1/localinventory#LocalInventory.FIELDS.store_code)
and
[`productId`](https://developers.google.com/shopping-content/reference/rest/v2.1/products#Product.FIELDS.id)
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](https://developers.google.com/shopping-content/reference/rest/v2.1/localinventory) reference
page.

## Methods

The local inventory service only includes two methods:

### localinventory.insert

[`localinventory.insert`](https://developers.google.com/shopping-content/reference/rest/v2.1/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](https://support.google.com/merchants/answer/9017019) 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](https://developers.google.com/shopping-content/guides/products/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`](https://developers.google.com/shopping-content/reference/rest/v2.1/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.

> [!NOTE]
> **Note:** It is not possible to retrieve, list, or delete local inventory instances. To view local inventory data in Merchant Center, select a local product in the **All products** page and then expand the **Local inventory** section. The table displays the local inventory data for each store code.