Stay organized with collectionsSave and categorize content based on your preferences.
You can use the Inventories sub-API to keep in-store information for your local
products up to date. This includes updatingpriceandavailability, and
removing stores a product is no longer sold in.
If you're a third-party provider, you can use the Inventories sub-API to create
an interface for your businesses to update the in-store availability of their
products.
This section explains how to view the stores associated with a product or
account.
By product
UselocalInventories.listto list all the local inventories connected to a specificproductin your
account. This call returns fullLocalInventoryresources. Use thestore_codeattribute to identify each store.
Here's a sample you can use to list local inventories for a product:
Java
importcom.google.api.gax.core.FixedCredentialsProvider;importcom.google.auth.oauth2.GoogleCredentials;importcom.google.shopping.merchant.inventories.v1.ListLocalInventoriesRequest;importcom.google.shopping.merchant.inventories.v1.LocalInventory;importcom.google.shopping.merchant.inventories.v1.LocalInventoryServiceClient;importcom.google.shopping.merchant.inventories.v1.LocalInventoryServiceClient.ListLocalInventoriesPagedResponse;importcom.google.shopping.merchant.inventories.v1.LocalInventoryServiceSettings;importshopping.merchant.samples.utils.Authenticator;importshopping.merchant.samples.utils.Config;/** This class demonstrates how to list all the Local inventories on a given product */publicclassListLocalInventoriesSample{privatestaticStringgetParent(StringaccountId,StringproductId){returnString.format("accounts/%s/products/%s",accountId,productId);}publicstaticvoidlistLocalInventories(Configconfig,StringproductId)throwsException{GoogleCredentialscredential=newAuthenticator().authenticate();LocalInventoryServiceSettingslocalInventoryServiceSettings=LocalInventoryServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credential)).build();Stringparent=getParent(config.getAccountId().toString(),productId);try(LocalInventoryServiceClientlocalInventoryServiceClient=LocalInventoryServiceClient.create(localInventoryServiceSettings)){// The parent product has the format: accounts/{account}/products/{product}ListLocalInventoriesRequestrequest=ListLocalInventoriesRequest.newBuilder().setParent(parent).build();System.out.println("Sending list Local inventory request:");ListLocalInventoriesPagedResponseresponse=localInventoryServiceClient.listLocalInventories(request);intcount=0;// Iterates over all rows in all pages and prints the Local inventory// in each row.for(LocalInventoryelement:response.iterateAll()){System.out.println(element);count++;}System.out.print("The following count of elements were returned: ");System.out.println(count);}catch(Exceptione){System.out.println(e);}}publicstaticvoidmain(String[]args)throwsException{Configconfig=Config.load();// An ID assigned to a product by Google. In the format// channel:contentLanguage:feedLabel:offerIdStringproductId="local:en:label:1111111111";listLocalInventories(config,productId);}}
use Google\ApiCore\ApiException;use Google\ApiCore\PagedListResponse;use Google\Shopping\Merchant\Inventories\V1\LocalInventory;use Google\Shopping\Merchant\Inventories\V1\Client\LocalInventoryServiceClient;use Google\Shopping\Merchant\Inventories\V1\ListLocalInventoriesRequest;/*** Class to list the `LocalInventory` resources for the given product in your* merchant account. The response might contain fewer items than specified by* `pageSize`. If `pageToken` was returned in previous request, it can be* used to obtain additional results.** `LocalInventory` resources are listed per product for a given account.*/class ListLocalInventories{// ENSURE you fill in the merchant account and product ID for the sample to// work.private const PARENT = 'accounts/[INSERT_ACCOUNT_HERE]/products/[INSERT_PRODUCT_HERE]';/*** Lists all the local inventories of a given product.** @param string $parent The `name` of the parent product to list `LocalInventory`* resources for.* Format: `accounts/{account}/products/{product}`*/function listLocalInventoriesSample(string $parent): void{// Gets the OAuth credentials to make the request.$credentials = Authentication::useServiceAccountOrTokenFile();// Creates options config containing credentials for the client to use.$options = ['credentials' => $credentials];// Creates a client.$localInventoryServiceClient = new LocalInventoryServiceClient($options);// Prepare the request message.$request = (new ListLocalInventoriesRequest())->setParent($parent);// Calls the API and catches and prints any network failures/errors.try {// Page size is set to the default value. If you are returned more// responses than your page size, this code will automatically// re-call the service with the `pageToken` until all responses// are returned.$parameters = ['pageSize' => 25000];/** @var PagedListResponse $response */$response =$localInventoryServiceClient->listLocalInventories($request, $parameters);/** @var LocalInventory $element */foreach ($response as $element) {printf('LocalInventory data: %s%s', $element->serializeToJsonString(), PHP_EOL);}} catch (ApiException $ex) {printf('Call failed with message: %s%s', $ex->getMessage(), PHP_EOL);}}// Helper to execute the sample.function callSample(): void{// Lists all the local inventories of the parent product.$this->listLocalInventoriesSample($this::PARENT);}}$sample = new ListLocalInventories();$sample->callSample();
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shoppingimportmerchant_inventories_v1# ENSURE you fill in the product ID for the sample to# work._ACCOUNT=configuration.Configuration().read_merchant_info()_PRODUCT="[INSERT_PRODUCT_HERE]"_PARENT=f"accounts/{_ACCOUNT}/products/{_PRODUCT}"deflist_local_inventories():"""Lists the `LocalInventory` resources for the given product.The response might contain fewer items than specified by`pageSize`. If `pageToken` was returned in previous request, it can beused to obtain additional results.`LocalInventory` resources are listed per product for a given account."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=merchant_inventories_v1.LocalInventoryServiceClient(credentials=credentials)# Creates the request.# Page size is set to the default value.request=merchant_inventories_v1.ListLocalInventoriesRequest(parent=_PARENT,page_size=25000)try:# Makes the request and catch and print any error messages.# If you are returned more responses than your page size, this code# will automatically re-call the service with the `pageToken` until all# responses are returned.page_result=client.list_local_inventories(request=request)# Print the response.forresponseinpage_result:print(response)exceptRuntimeErrorase:print("List failed")print(e)if__name__=="__main__":list_local_inventories()
You can view all the stores associated with your account in yourBusiness
Profile, or with theGoogle My Business
API. You can't use Merchant API to view or manage
stores at the account level, since this information comes from your Business
Profile.
Remove stores
Here's how to remove stores you no longer sell products in.
From products
If a product is no longer sold at a specific store, you should remove the local
inventory entry for that store from the product. You can uselocalInventories.deleteto remove a specific local inventory entry from a product.
Here's a sample you can use to remove a local inventory entry from a product:
Java
importcom.google.api.gax.core.FixedCredentialsProvider;importcom.google.auth.oauth2.GoogleCredentials;importcom.google.shopping.merchant.inventories.v1.DeleteLocalInventoryRequest;importcom.google.shopping.merchant.inventories.v1.LocalInventoryName;importcom.google.shopping.merchant.inventories.v1.LocalInventoryServiceClient;importcom.google.shopping.merchant.inventories.v1.LocalInventoryServiceSettings;importshopping.merchant.samples.utils.Authenticator;importshopping.merchant.samples.utils.Config;/** This class demonstrates how to delete a Local inventory for a given product */publicclassDeleteLocalInventorySample{publicstaticvoiddeleteLocalInventory(Configconfig,StringproductId,StringstoreCode)throwsException{GoogleCredentialscredential=newAuthenticator().authenticate();LocalInventoryServiceSettingslocalInventoryServiceSettings=LocalInventoryServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credential)).build();Stringname=LocalInventoryName.newBuilder().setAccount(config.getAccountId().toString()).setProduct(productId).setStoreCode(storeCode).build().toString();try(LocalInventoryServiceClientlocalInventoryServiceClient=LocalInventoryServiceClient.create(localInventoryServiceSettings)){DeleteLocalInventoryRequestrequest=DeleteLocalInventoryRequest.newBuilder().setName(name).build();System.out.println("Sending deleteLocalInventory request");localInventoryServiceClient.deleteLocalInventory(request);// no response returned on successSystem.out.println("Delete successful, note that it may take up to 30 minutes for the delete to update in"+" the system.");}catch(Exceptione){System.out.println(e);}}publicstaticvoidmain(String[]args)throwsException{Configconfig=Config.load();// An ID assigned to a product by Google. In the format// channel:contentLanguage:feedLabel:offerIdStringproductId="local:en:label:1111111111";// The ID uniquely identifying each region.StringstoreCode="EXAMPLE";deleteLocalInventory(config,productId,storeCode);}}
use Google\ApiCore\ApiException;use Google\Shopping\Merchant\Inventories\V1\Client\LocalInventoryServiceClient;use Google\Shopping\Merchant\Inventories\V1\DeleteLocalInventoryRequest;/*** Deletes the specified `LocalInventory` resource from the given product* in your merchant account. It might take up to an hour for the* `LocalInventory` to be deleted from the specific product.* Once you have received a successful delete response, wait for that* period before attempting a delete again.*/class DeleteLocalInventory{// ENSURE you fill in the merchant account, product, and region ID for the// sample to work.private const ACCOUNT = 'INSERT_ACCOUNT_ID_HERE';private const PRODUCT = 'INSERT_PRODUCT_ID_HERE';private const STORE_CODE = 'INSERT_STORE_CODE_HERE';/*** Deletes a specific local inventory of a given product.** @param string $formattedName The name of the `LocalInventory` resource* to delete.* Format: `accounts/{account}/products/{product}/localInventories/{store_code}`* Please see {@see LocalInventoryServiceClient::localInventoryName()}* for help formatting this field.*/function deleteLocalInventorySample(string $formattedName): void{// Gets the OAuth credentials to make the request.$credentials = Authentication::useServiceAccountOrTokenFile();// Creates options config containing credentials for the client to use.$options = ['credentials' => $credentials];// Creates a client.$localInventoryServiceClient = new LocalInventoryServiceClient($options);// Prepare the request message.$request = (new DeleteLocalInventoryRequest())->setName($formattedName);// Calls the API and catches and prints any network failures/errors.try {$localInventoryServiceClient->deleteLocalInventory($request);print 'Delete call completed successfully.' . PHP_EOL;} catch (ApiException $ex) {printf('Call failed with message: %s%s', $ex->getMessage(), PHP_EOL);}}/*** Helper to execute the sample.*/function callSample(): void{// These variables are defined at the top of the file.$formattedName = LocalInventoryServiceClient::localInventoryName($this::ACCOUNT,$this::PRODUCT,$this::STORE_CODE);// Deletes the specific local inventory of the parent product.$this->deleteLocalInventorySample($formattedName);}}$sample = new DeleteLocalInventory();$sample->callSample();
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shoppingimportmerchant_inventories_v1# ENSURE you fill in the product ID and store code# for the sample to work._ACCOUNT=configuration.Configuration().read_merchant_info()_PRODUCT="[INSERT_PRODUCT_HERE]"_STORE_CODE="[INSERT_STORE_CODE_HERE]"_NAME=(f"accounts/{_ACCOUNT}/products/{_PRODUCT}/localInventories/"f"{_STORE_CODE}")defdelete_local_inventory():"""Deletes the specified `LocalInventory` resource from the given product.It might take up to an hour for the `LocalInventory` to be deletedfrom the specific product. Once you have received a successful deleteresponse, wait for that period before attempting a delete again."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=merchant_inventories_v1.LocalInventoryServiceClient(credentials=credentials)# Creates the request.request=merchant_inventories_v1.DeleteLocalInventoryRequest(name=_NAME)# Makes the request and catch and print any error messages.try:client.delete_local_inventory(request=request)print("Delete successful")exceptRuntimeErrorase:print("Delete failed")print(e)if__name__=="__main__":delete_local_inventory()
This call removes information for only the specified store, from only the
specified product.
From accounts
You can remove stores where you no longer sell your products from your account
by removing them from yourBusiness Profile. SeeClose or remove a businessfor
more information.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eUse the Merchant Inventories API to update the price and availability of your local products in specific stores.\u003c/p\u003e\n"],["\u003cp\u003eManage your local product inventory by adding, updating, and removing store information using the API's methods like \u003ccode\u003elocalInventories.insert\u003c/code\u003e and \u003ccode\u003elocalInventories.delete\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eView your existing stores associated with a product through \u003ccode\u003elocalInventories.list\u003c/code\u003e or manage your account-level stores via your Business Profile.\u003c/p\u003e\n"],["\u003cp\u003eThird-party providers can utilize this API to build interfaces for their merchants, enabling them to control the in-store availability of their products.\u003c/p\u003e\n"]]],[],null,[]]