Omnichannel Settings API is the entry point to configuring your Local
Inventory Ads (LIA) and Free Local Listings (FLL) programs.

Use it to programmatically

- Manage (create and update) Omnichannel Settings
- Fetch (get and list) Omnichannel Settings
- Request inventory verification for eligible merchants

For more information, see
[Local inventory ads and free local listings overview](https://support.google.com/merchants/answer/14615117?visit_id=638780257919957405-870630059&rd=1).

## Prerequisites

You should have

- a Merchant Center account

- a Business Profile. If you don't have one, you can create one. See
  [Sign up for a Business Profile](https://support.google.com/business/?visit_id=638780257919957405-870630059&rd=2&topic=4539638#topic=4596754).

- A link between your Business Profile and your Merchant Center
  account. To create the link, you can use the Merchant Center user
  interface or Merchant API (see [Link a Google Business Profile](https://developers.google.com/merchant/api/guides/accounts/link-business-profile)).

## Create an omnichannel setting

You can use the `omnichannelSettings.create` method to create an omnichannel
setting. The create method takes an `omnichannelSetting` resource as input and
returns the created omnichannel setting, if successful.

When creating, you must fill in both the `regionCode` and the
[`LsfType`](https://developers.google.com/merchant/api/guides/accounts/manage-omnichannel-settings#lsf-type):

- OmnichannelSetting is on a per-country basis. `RegionCode` defines the targeted country. Once created, you cannot change it. `RegionCode` should follow the naming rule defined by the [Common Locale Data Repository
  (CLDR)](https://cldr.unicode.org/) project.
- `LsfType` is based on your product page. For details, see [`LsfType`](https://developers.google.com/merchant/api/guides/accounts/manage-omnichannel-settings#lsf-type).

For more detail, see
[Change the product page experience for your local inventory ads](https://support.google.com/merchants/answer/14895476?visit_id=638780257919957405-870630059&rd=1).

You don't have to fill in all the fields at the creation stage, but can
configure them later instead. To update an existing `omnichannelSetting`, see
[Update an omnichannel setting](https://developers.google.com/merchant/api/guides/accounts/manage-omnichannel-settings#update-omnichannel-setting).

Here is a sample request if you were to choose `MHLSF_BASIC` and enroll
`inStock`:

    POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings

    {
      "regionCode": "{REGION_CODE}",
      "lsfType: "MHLSF_BASIC",
      "inStock": {
          "uri": {URI}"
      }
    }

Replace the following:

- `{ACCOUNT_ID}`: The unique identifier of your Merchant Center account
- `{REGION_CODE}`: A region code as defined by CLDR
- `{URI}`: A valid URI used for the given review. An ineligible URI may prevent approval.

After the request runs successfully, you should see the following response:

    {
      "name": "accounts/{ACCOUNT_ID}/omnichannelSettings/{omnichannel_setting}",
      "regionCode": "{REGION_CODE}",
      "lsfType: "MHLSF_BASIC",
      "inStock": {
          "uri": "{URI}",
          "state": "RUNNING"
      }
    }

Enrolling different LIA/FLL features using `omnichannelSetting` fields triggers
manual reviews that usually require a couple of hours to a couple of days. We
recommend double-checking your inputs to avoid unnecessary waiting time due to
an ineligible data.

To view your newly-created omnichannel setting or check the state of reviews,
use `accounts.omnichannelSettings.get` or `accounts.omnichannelSettings.list`,
specifying the country.

### Local Store Front (LSF) Type

Based on the product page you plan to use, choose an `LsfType`:

| Product page type | LsfType | Enum value |
|---|---|---|
| Product pages with in-store availability | Merchant-Hosted Local Store Front Basic | `MHLSF_BASIC` |
| Store-specific product pages with availability and price | Merchant-Hosted Local Store Front Full | `MHLSF_FULL` |
| Product pages without in-store availability | Google-Hosted Local Store Front (GHLSF) | `GHLSF` |

If you choose Merchant-hosted local store front types, you also need to fill in
the URI field for at least one of [`inStock`](https://developers.google.com/merchant/api/guides/accounts/manage-omnichannel-settings#instock) or [`pickup`](https://developers.google.com/merchant/api/guides/accounts/manage-omnichannel-settings#pickup).

#### InStock

You can use InStock to provide more information about your product page.

If you choose Merchant-Hosted LSF types and specify the URI field in InStock,
you're showing your intention to serve products with in-stock availability. We
will start a review based on the provided URI.

If you choose the `GHLSF` type, you need to supply an empty `InStock` field in
the request. Unlike Merchant-hosted LSF types, to complete onboarding, you need
to complete the [Inventory Verification](https://developers.google.com/merchant/api/guides/accounts/manage-omnichannel-settings#inventory-verification) process.

This code sample creates an `omnichannelSetting` with `GHLSF`:

### Java

    import com.google.api.gax.core.FixedCredentialsProvider;
    import com.google.auth.oauth2.GoogleCredentials;
    import com.google.shopping.merchant.accounts.v1.AccountName;
    import com.google.shopping.merchant.accounts.v1.CreateOmnichannelSettingRequest;
    import com.google.shopping.merchant.accounts.v1.InStock;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSetting;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSetting.LsfType;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
    import shopping.merchant.samples.utils.Authenticator;
    import shopping.merchant.samples.utils.Config;

    /**
     * This class demonstrates how to create an omnichannel setting for a given Merchant Center account
     * in a given country
     */
    public class CreateOmnichannelSettingSample {

      public static void createOmnichannelSetting(Config config, String regionCode) throws Exception {

        // Obtains OAuth token based on the user's configuration.
        GoogleCredentials credential = new Authenticator().authenticate();

        // Creates service settings using the credentials retrieved above.
        OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
            OmnichannelSettingsServiceSettings.newBuilder()
                .setCredentialsProvider(FixedCredentialsProvider.create(credential))
                .build();

        // Calls the API and catches and prints any network failures/errors.
        try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
            OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
          String accountId = config.getAccountId().toString();
          String parent = AccountName.newBuilder().setAccount(accountId).build().toString();

          // Creates an omnichannel setting with GHLSF type in the given country.
          CreateOmnichannelSettingRequest request =
              CreateOmnichannelSettingRequest.newBuilder()
                  .setParent(parent)
                  .setOmnichannelSetting(
                      OmnichannelSetting.newBuilder()
                          .setRegionCode(regionCode)
                          .setLsfType(LsfType.GHLSF)
                          .setInStock(InStock.getDefaultInstance())
                          .build())
                  .build();

          System.out.println("Sending create omnichannel setting request:");
          OmnichannelSetting response =
              omnichannelSettingsServiceClient.createOmnichannelSetting(request);

          System.out.println("Inserted Omnichannel Setting below:");
          System.out.println(response);
        } catch (Exception e) {
          System.out.println("An error has occured: ");
          System.out.println(e);
        }
      }

      public static void main(String[] args) throws Exception {
        Config config = Config.load();

        // The country which you're targeting at.
        String regionCode = "{REGION_CODE}";

        createOmnichannelSetting(config, regionCode);
      }
    }

### PHP

    use Google\ApiCore\ApiException;
    use Google\Shopping\Merchant\Accounts\V1\Client\OmnichannelSettingsServiceClient;
    use Google\Shopping\Merchant\Accounts\V1\CreateOmnichannelSettingRequest;
    use Google\Shopping\Merchant\Accounts\V1\InStock;
    use Google\Shopping\Merchant\Accounts\V1\OmnichannelSetting;
    use Google\Shopping\Merchant\Accounts\V1\OmnichannelSetting\LsfType;

    /**
     * This class demonstrates how to create an omnichannel setting for a given
     * Merchant Center account in a given country.
     */
    class CreateOmnichannelSetting
    {
        /**
         * Helper to create the parent string.
         *
         * @param string $accountId The merchant account ID.
         * @return string The parent string in the format `accounts/{account}`.
         */
        private static function getParent(string $accountId): string
        {
            return sprintf('accounts/%s', $accountId);
        }

        /**
         * Creates an omnichannel setting for a given Merchant Center account.
         *
         * @param array $config The configuration file for authentication.
         * @param string $regionCode The country for the omnichannel setting.
         */
        public static function createOmnichannelSettingSample(
            array $config,
            string $regionCode
        ): void {
            // Obtains OAuth credentials from the configuration file.
            $credentials = Authentication::useServiceAccountOrTokenFile();

            // Creates a client.
            $omnichannelSettingsServiceClient = new OmnichannelSettingsServiceClient([
                'credentials' => $credentials
            ]);

            // Constructs the parent resource name.
            $parent = self::getParent($config['accountId']);

            // Creates the omnichannel setting with GHLSF type in the given country.
            $omnichannelSetting = new OmnichannelSetting([
                'region_code' => $regionCode,
                'lsf_type' => LsfType::GHLSF,
                'in_stock' => new InStock()
            ]);

            // Creates the request.
            $request = new CreateOmnichannelSettingRequest([
                'parent' => $parent,
                'omnichannel_setting' => $omnichannelSetting
            ]);

            // Calls the API and prints the response.
            try {
                printf("Sending create omnichannel setting request:%s", PHP_EOL);
                $response = $omnichannelSettingsServiceClient->createOmnichannelSetting($request);
                printf("Inserted Omnichannel Setting below:%s", PHP_EOL);
                print $response->serializeToJsonString(true) . PHP_EOL;
            } catch (ApiException $e) {
                printf("An error has occured: %s", $e->getMessage());
            }
        }

        /**
         * Executes the sample.
         */
        public function callSample(): void
        {
            $config = Config::generateConfig();
            // The country which you're targeting.
            $regionCode = '{REGION_CODE}';
            self::createOmnichannelSettingSample($config, $regionCode);
        }
    }

    // Runs the script.
    $sample = new CreateOmnichannelSetting();
    $sample->callSample();

### Python

    from examples.authentication import configuration
    from examples.authentication import generate_user_credentials
    from google.shopping.merchant_accounts_v1 import CreateOmnichannelSettingRequest
    from google.shopping.merchant_accounts_v1 import InStock
    from google.shopping.merchant_accounts_v1 import OmnichannelSetting
    from google.shopping.merchant_accounts_v1 import OmnichannelSettingsServiceClient


    def create_omnichannel_setting(account_id: str, region_code: str) -> None:
      """Creates an omnichannel setting for a given Merchant Center account.

      Args:
          account_id: The ID of the Merchant Center account.
          region_code: The country for which you're creating the setting.
      """
      # Gets OAuth Credentials.
      credentials = generate_user_credentials.main()

      # Creates a client.
      client = OmnichannelSettingsServiceClient(credentials=credentials)

      # The parent account under which to create the setting.
      parent = f"accounts/{account_id}"

      # Creates an omnichannel setting with GHLSF type in the given country.
      omnichannel_setting = OmnichannelSetting()
      omnichannel_setting.region_code = region_code
      omnichannel_setting.lsf_type = OmnichannelSetting.LsfType.GHLSF
      omnichannel_setting.in_stock = InStock()

      # Creates the request.
      request = CreateOmnichannelSettingRequest(
          parent=parent, omnichannel_setting=omnichannel_setting
      )

      # Makes the request and catches and prints any error messages.
      try:
        print("Sending create omnichannel setting request:")
        response = client.create_omnichannel_setting(request=request)
        print("Inserted Omnichannel Setting below:")
        print(response)
      except RuntimeError as e:
        print("An error has occured: ")
        print(e)


    if __name__ == "__main__":
      # The ID of the account to get the omnichannel settings for.
      _ACCOUNT = configuration.Configuration().read_merchant_info()

      # The country which you're targeting.
      _REGION_CODE = "{REGION_CODE}"

      create_omnichannel_setting(_ACCOUNT, _REGION_CODE)

#### Pickup

Apart from in-store availability, you can also enhance your in-store products
with the Pickup feature, which is only eligible for Merchant-hosted LSF types.

When a product is marked for Pickup, it means that a customer can buy it online
and pick it up at the store. By setting the `Pickup` field, you are showing your
intention to serve products with a pickup SLA. We will start a review based on
the provided URI.

Here is a sample request that creates an `omnichannel` setting with `Pickup`:

    POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings

    {
      "regionCode": "{REGION_CODE}",
      "lsfType: "MHLSF_BASIC",
      "pickup": {
         "uri: "{URI}"
      }
    }

### On display to order

With the
[on display to order](https://support.google.com/merchants/answer/14615056?visit_id=638799001372962453-121613319&rd=1)
feature, you can show products that are displayed in your physical store, but
not available for immediate purchase. For example, large furniture:

- Customers who are looking for similar products on Google will see these ads with the "in-store" annotation in their search results.
- Customers who are browsing the store on a Google Search result page will see these products marked as "Available to order".

They can choose your local inventory ad or free local listing to view the item.
To buy the item, they can visit your physical store, view the item, and then
order it to be shipped to them or shipped to your store for pick up.

### About (Germany, Austria and Switzerland)

If you're serving in Austria and Germany and choose `GHLSF`, you must submit an
[About](https://support.google.com/merchants/answer/14675634?visit_id=638799001375002784-1955215785&rd=1)
page.

If you're serving in Switzerland, you must submit an "About" page regardless of
`LsfType`.

Until the About page URL is verified, `GHLSF` merchants cannot request manual
inventory verification from Google.

For all merchants in these three countries, the service does not enable the
FLL/LIA features until your About page receives approval.

> [!NOTE]
> **Note:** This feature won't work without the `InStock` approval.

### Inventory Verification

Inventory Verification is only required for `GHLSF` merchants. It is not
supported for `MHLSF` types.

Either before or after you add product data and inventory data (either using
`accounts.products.localInventories.insert` or the Merchant Center user
interface), you must verify your contact. Provide an inventory verification
contact (name and email address) using the `create` or `update` method. The
contact will receive an email sent by Google and the ability to verify their
status by clicking a button in the message.

Once you have completed this, you can [Request inventory
verification](https://developers.google.com/merchant/api/guides/accounts/manage-omnichannel-settings#request-inventory-verification). For more information see
[About inventory verification](https://support.google.com/merchants/answer/14684499?visit_id=638799001375002784-1955215785&rd=1).

You can change your contact during the verification process or after
verification using `omnichannelSetting.update`.

After this process is complete, Google validates the accuracy of the provided
information.

## Get an omnichannel setting

To retrieve the `omnichannelSetting` configuration in a given country, or check
the current status of your reviews, use the `omnichannelSettings.get` method.

Here's a sample request:

    GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{OMNICHANNEL_SETTING}

Replace the following:

- `{ACCOUNT_ID}`: The unique identifier of your Merchant Center account
- `{OMNICHANNEL_SETTING}`: The region code of your targeted country

The `ACTIVE` status indicates that the review has received approval.

If the status is `FAILED`, address the issues and trigger a new review by
calling `omnichannelSetting.update`.

The read-only `LFP` field shows your Local Feeds Partnership status. To link to
the partnership, use `lfpProviders.linkLfpProvider`.

For more information on checking statuses and their meanings, see [View the
status of an omnichannel setting](https://developers.google.com/merchant/api/guides/accounts/manage-omnichannel-settings#view-status-omnichannel-setting).

## List Omnichannel Settings

To retrieve all `omnichannelSetting` information for your account, use the
`omnichannelSettings.list` method.

Here's a code sample:

### Java

    import com.google.api.gax.core.FixedCredentialsProvider;
    import com.google.auth.oauth2.GoogleCredentials;
    import com.google.shopping.merchant.accounts.v1.AccountName;
    import com.google.shopping.merchant.accounts.v1.ListOmnichannelSettingsRequest;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSetting;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient.ListOmnichannelSettingsPagedResponse;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
    import shopping.merchant.samples.utils.Authenticator;
    import shopping.merchant.samples.utils.Config;

    /**
     * This class demonstrates how to get the list of omnichannel settings for a given Merchant Center
     * account
     */
    public class ListOmnichannelSettingsSample {

      public static void omnichannelSettings(Config config) throws Exception {

        // Obtains OAuth token based on the user's configuration.
        GoogleCredentials credential = new Authenticator().authenticate();

        // Creates service settings using the credentials retrieved above.
        OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
            OmnichannelSettingsServiceSettings.newBuilder()
                .setCredentialsProvider(FixedCredentialsProvider.create(credential))
                .build();

        String accountId = config.getAccountId().toString();
        String parent = AccountName.newBuilder().setAccount(accountId).build().toString();

        // Calls the API and catches and prints any network failures/errors.
        try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
            OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
          ListOmnichannelSettingsRequest request =
              ListOmnichannelSettingsRequest.newBuilder().setParent(parent).build();

          System.out.println("Sending list omnichannel setting request:");
          ListOmnichannelSettingsPagedResponse response =
              omnichannelSettingsServiceClient.listOmnichannelSettings(request);

          int count = 0;

          // Iterates over all the entries in the response.
          for (OmnichannelSetting omnichannelSetting : response.iterateAll()) {
            System.out.println(omnichannelSetting);
            count++;
          }
          System.out.println(String.format("The following count of elements were returned: %d", count));
        } catch (Exception e) {
          System.out.println("An error has occured: ");
          System.out.println(e);
        }
      }

      public static void main(String[] args) throws Exception {
        Config config = Config.load();

        omnichannelSettings(config);
      }
    }

### PHP

    use Google\ApiCore\ApiException;
    use Google\Shopping\Merchant\Accounts\V1\Client\OmnichannelSettingsServiceClient;
    use Google\Shopping\Merchant\Accounts\V1\ListOmnichannelSettingsRequest;

    /**
     * This class demonstrates how to get the list of omnichannel settings for a
     * given Merchant Center account.
     */
    class ListOmnichannelSettings
    {
        /**
         * Helper to create the parent string.
         *
         * @param string $accountId The merchant account ID.
         * @return string The parent string in the format `accounts/{account}`.
         */
        private static function getParent(string $accountId): string
        {
            return sprintf('accounts/%s', $accountId);
        }

        /**
         * Lists the omnichannel settings for a given Merchant Center account.
         *
         * @param array $config The configuration file for authentication.
         */
        public static function listOmnichannelSettingsSample(array $config): void
        {
            // Obtains OAuth credentials from the configuration file.
            $credentials = Authentication::useServiceAccountOrTokenFile();

            // Creates a client.
            $omnichannelSettingsServiceClient = new OmnichannelSettingsServiceClient([
                'credentials' => $credentials
            ]);

            // Constructs the parent resource name.
            $parent = self::getParent($config['accountId']);

            // Creates the request.
            $request = new ListOmnichannelSettingsRequest(['parent' => $parent]);

            // Calls the API and prints the response.
            try {
                printf("Sending list omnichannel setting request:%s", PHP_EOL);
                $response = $omnichannelSettingsServiceClient->listOmnichannelSettings($request);

                $count = 0;
                // Iterates over all the omnichannel settings and prints them.
                foreach ($response->iterateAllElements() as $omnichannelSetting) {
                    print $omnichannelSetting->serializeToJsonString(true) . PHP_EOL;
                    $count++;
                }
                printf("The following count of elements were returned: %d%s", $count, PHP_EOL);
            } catch (ApiException $e) {
                printf("An error has occured: %s", $e->getMessage());
            }
        }

        /**
         * Executes the sample.
         */
        public function callSample(): void
        {
            $config = Config::generateConfig();
            self::listOmnichannelSettingsSample($config);
        }
    }

    // Runs the script.
    $sample = new ListOmnichannelSettings();
    $sample->callSample();

### Python

    from examples.authentication import configuration
    from examples.authentication import generate_user_credentials
    from google.shopping.merchant_accounts_v1 import ListOmnichannelSettingsRequest
    from google.shopping.merchant_accounts_v1 import OmnichannelSettingsServiceClient


    def list_omnichannel_settings(account_id: str) -> None:
      """Lists the omnichannel settings for a given Merchant Center account.

      Args:
          account_id: The ID of the Merchant Center account.
      """
      # Gets OAuth Credentials.
      credentials = generate_user_credentials.main()

      # Creates a client.
      client = OmnichannelSettingsServiceClient(credentials=credentials)

      # The parent account for which to list the settings.
      parent = f"accounts/{account_id}"

      # Creates the request.
      request = ListOmnichannelSettingsRequest(parent=parent)

      # Makes the request and catches and prints any error messages.
      try:
        print("Sending list omnichannel setting request:")
        response = client.list_omnichannel_settings(request=request)

        count = 0
        # Iterates over all the entries in the response.
        for omnichannel_setting in response:
          print(omnichannel_setting)
          count += 1
        print(f"The following count of elements were returned: {count}")
      except RuntimeError as e:
        print("An error has occured: ")
        print(e)


    if __name__ == "__main__":
      # The ID of the account to get the omnichannel settings for.
      _ACCOUNT = configuration.Configuration().read_merchant_info()

      list_omnichannel_settings(_ACCOUNT)

## Update an omnichannel setting

To update the configuration of an existing omnichannel setting use the
`omnichannelSettings.update` method.

To update, you must add the feature you want to the update mask, and fill in the
corresponding fields in the `omnichannelSetting` field in the update request.
You can update any of

- `lsfType`
- `inStock`
- `pickup`
- `odo`
- `about`
- `inventoryVerification`

If an attribute is not included in the update mask, it won't be updated.

If an attribute is included in the update mask, but not set in the request, it
will be cleared.

The following code sample demonstrates how to update the inventory verification
field.

### Java

    import com.google.api.gax.core.FixedCredentialsProvider;
    import com.google.auth.oauth2.GoogleCredentials;
    import com.google.protobuf.FieldMask;
    import com.google.shopping.merchant.accounts.v1.InventoryVerification;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSetting;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingName;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
    import com.google.shopping.merchant.accounts.v1.UpdateOmnichannelSettingRequest;
    import shopping.merchant.samples.utils.Authenticator;
    import shopping.merchant.samples.utils.Config;

    /**
     * This class demonstrates how to update an omnichannel setting for a given Merchant Center account
     * in a given country
     */
    public class UpdateOmnichannelSettingSample {

      public static void updateOmnichannelSettings(
          Config config, String regionCode, String contact, String email) throws Exception {

        // Obtains OAuth token based on the user's configuration.
        GoogleCredentials credential = new Authenticator().authenticate();

        // Creates service settings using the credentials retrieved above.
        OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
            OmnichannelSettingsServiceSettings.newBuilder()
                .setCredentialsProvider(FixedCredentialsProvider.create(credential))
                .build();

        // Calls the API and catches and prints any network failures/errors.
        try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
            OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
          String accountId = config.getAccountId().toString();
          String name =
              OmnichannelSettingName.newBuilder()
                  .setAccount(accountId)
                  .setOmnichannelSetting(regionCode)
                  .build()
                  .toString();

          OmnichannelSetting omnichannelSetting =
              OmnichannelSetting.newBuilder()
                  .setName(name)
                  .setInventoryVerification(
                      InventoryVerification.newBuilder()
                          .setContact(contact)
                          .setContactEmail(email)
                          .build())
                  .build();
          FieldMask fieldMask = FieldMask.newBuilder().addPaths("inventory_verification").build();
          UpdateOmnichannelSettingRequest request =
              UpdateOmnichannelSettingRequest.newBuilder()
                  .setOmnichannelSetting(omnichannelSetting)
                  .setUpdateMask(fieldMask)
                  .build();

          System.out.println("Sending update omnichannel setting request:");
          OmnichannelSetting response =
              omnichannelSettingsServiceClient.updateOmnichannelSetting(request);

          System.out.println("Updated Omnichannel Setting below:");
          System.out.println(response);
        } catch (Exception e) {
          System.out.println("An error has occured: ");
          System.out.println(e);
        }
      }

      public static void main(String[] args) throws Exception {
        Config config = Config.load();

        // The country which you're targeting at.
        String regionCode = "{REGION_CODE}";
        // The name of the inventory verification contact you want to update.
        String contact = "{NAME}";
        // The address of the inventory verification email you want to update.
        String email = "{EMAIL}";

        updateOmnichannelSettings(config, regionCode, contact, email);
      }
    }

### PHP

    use Google\ApiCore\ApiException;
    use Google\Protobuf\FieldMask;
    use Google\Shopping\Merchant\Accounts\V1\Client\OmnichannelSettingsServiceClient;
    use Google\Shopping\Merchant\Accounts\V1\InventoryVerification;
    use Google\Shopping\Merchant\Accounts\V1\OmnichannelSetting;
    use Google\Shopping\Merchant\Accounts\V1\UpdateOmnichannelSettingRequest;

    /**
     * This class demonstrates how to update an omnichannel setting for a given
     * Merchant Center account in a given country.
     */
    class UpdateOmnichannelSetting
    {
        /**
         * Helper to create the name string.
         *
         * @param string $accountId The merchant account ID.
         * @param string $regionCode The region code of the setting.
         * @return string The name string in the format
         *     `accounts/{account}/omnichannelSettings/{omnichannelSetting}`.
         */
        private static function getName(string $accountId, string $regionCode): string
        {
            return sprintf('accounts/%s/omnichannelSettings/%s', $accountId, $regionCode);
        }

        /**
         * Updates an omnichannel setting for a given Merchant Center account.
         *
         * @param array $config The configuration file for authentication.
         * @param string $regionCode The country of the omnichannel setting.
         * @param string $contact The name of the inventory verification contact.
         * @param string $email The email of the inventory verification contact.
         */
        public static function updateOmnichannelSettingSample(
            array $config,
            string $regionCode,
            string $contact,
            string $email
        ): void {
            // Obtains OAuth credentials from the configuration file.
            $credentials = Authentication::useServiceAccountOrTokenFile();

            // Creates a client.
            $omnichannelSettingsServiceClient = new OmnichannelSettingsServiceClient([
                'credentials' => $credentials
            ]);

            // Constructs the resource name.
            $name = self::getName($config['accountId'], $regionCode);

            // Creates the omnichannel setting with the updated fields.
            $omnichannelSetting = new OmnichannelSetting([
                'name' => $name,
                'inventory_verification' => new InventoryVerification([
                    'contact' => $contact,
                    'contact_email' => $email
                ])
            ]);

            // Creates the field mask to specify which fields to update.
            $fieldMask = new FieldMask([
                'paths' => ['inventory_verification']
            ]);

            // Creates the request.
            $request = new UpdateOmnichannelSettingRequest([
                'omnichannel_setting' => $omnichannelSetting,
                'update_mask' => $fieldMask
            ]);

            // Calls the API and prints the response.
            try {
                printf("Sending update omnichannel setting request:%s", PHP_EOL);
                $response = $omnichannelSettingsServiceClient->updateOmnichannelSetting($request);
                printf("Updated Omnichannel Setting below:%s", PHP_EOL);
                print $response->serializeToJsonString(true) . PHP_EOL;
            } catch (ApiException $e) {
                printf("An error has occured: %s", $e->getMessage());
            }
        }

        /**
         * Executes the sample.
         */
        public function callSample(): void
        {
            $config = Config::generateConfig();
            // The country which you're targeting.
            $regionCode = '{REGION_CODE}';
            // The name of the inventory verification contact you want to update.
            $contact = '{NAME}';
            // The address of the inventory verification email you want to update.
            $email = '{EMAIL}';
            self::updateOmnichannelSettingSample($config, $regionCode, $contact, $email);
        }
    }

    // Runs the script.
    $sample = new UpdateOmnichannelSetting();
    $sample->callSample();

### Python

    from examples.authentication import configuration
    from examples.authentication import generate_user_credentials
    from google.protobuf import field_mask_pb2
    from google.shopping.merchant_accounts_v1 import InventoryVerification
    from google.shopping.merchant_accounts_v1 import OmnichannelSetting
    from google.shopping.merchant_accounts_v1 import OmnichannelSettingsServiceClient
    from google.shopping.merchant_accounts_v1 import (
        UpdateOmnichannelSettingRequest,
    )


    def update_omnichannel_setting(
        account_id: str, region_code: str, contact: str, email: str
    ) -> None:
      """Updates an omnichannel setting for a given Merchant Center account.

      Args:
          account_id: The ID of the Merchant Center account.
          region_code: The country for which you're updating the setting.
          contact: The name of the inventory verification contact.
          email: The email of the inventory verification contact.
      """
      # Gets OAuth Credentials.
      credentials = generate_user_credentials.main()

      # Creates a client.
      client = OmnichannelSettingsServiceClient(credentials=credentials)

      # The name of the omnichannel setting to update.
      name = f"accounts/{account_id}/omnichannelSettings/{region_code}"

      # Creates an omnichannel setting with the updated values.
      omnichannel_setting = OmnichannelSetting()
      omnichannel_setting.name = name
      omnichannel_setting.inventory_verification = InventoryVerification(
          contact=contact, contact_email=email
      )

      # Creates a field mask to specify which fields to update.
      field_mask = field_mask_pb2.FieldMask(paths=["inventory_verification"])

      # Creates the request.
      request = UpdateOmnichannelSettingRequest(
          omnichannel_setting=omnichannel_setting, update_mask=field_mask
      )

      # Makes the request and catches and prints any error messages.
      try:
        print("Sending update omnichannel setting request:")
        response = client.update_omnichannel_setting(request=request)
        print("Updated Omnichannel Setting below:")
        print(response)
      except RuntimeError as e:
        print("An error has occured: ")
        print(e)


    if __name__ == "__main__":
      # The ID of the account to get the omnichannel settings for.
      _ACCOUNT = configuration.Configuration().read_merchant_info()

      # The country which you're targeting.
      _REGION_CODE = "{REGION_CODE}"
      # The name of the inventory verification contact you want to update.
      _CONTACT = "{NAME}"
      # The address of the inventory verification email you want to update.
      _EMAIL = "{EMAIL}"

      update_omnichannel_setting(_ACCOUNT, _REGION_CODE, _CONTACT, _EMAIL)

## Request inventory verification

`omnichannelSettings.requestInventoryVerification` is only relevant to `GHLSF`
merchants.

Before you call this RPC, you need to have performed the following:

- Upload your product and inventory data.
- Verify an inventory verification contact.
- For merchants in Austria, Germany or Switzerland, complete an [`About`](https://developers.google.com/merchant/api/guides/accounts/manage-omnichannel-settings#about) page review.

To determine your eligibility, call `omnichannelSettings.get` and check
`omnichannelSetting.inventoryVerification.state`. If it shows `INACTIVE`, you're
ready to call `omnichannelSettings.requestInventoryVerification`.

### Java

    import com.google.api.gax.core.FixedCredentialsProvider;
    import com.google.auth.oauth2.GoogleCredentials;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingName;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
    import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
    import com.google.shopping.merchant.accounts.v1.RequestInventoryVerificationRequest;
    import com.google.shopping.merchant.accounts.v1.RequestInventoryVerificationResponse;
    import shopping.merchant.samples.utils.Authenticator;
    import shopping.merchant.samples.utils.Config;

    /**
     * This class demonstrates how to request inventory verification for a given Merchant Center account
     * in a given country
     */
    public class RequestInventoryVerificationSample {

      public static void requestInventoryVerification(Config config, String regionCode)
          throws Exception {

        // Obtains OAuth token based on the user's configuration.
        GoogleCredentials credential = new Authenticator().authenticate();

        // Creates service settings using the credentials retrieved above.
        OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
            OmnichannelSettingsServiceSettings.newBuilder()
                .setCredentialsProvider(FixedCredentialsProvider.create(credential))
                .build();

        // Calls the API and catches and prints any network failures/errors.
        try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
            OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
          String accountId = config.getAccountId().toString();
          String name =
              OmnichannelSettingName.newBuilder()
                  .setAccount(accountId)
                  .setOmnichannelSetting(regionCode)
                  .build()
                  .toString();
          RequestInventoryVerificationRequest request =
              RequestInventoryVerificationRequest.newBuilder().setName(name).build();

          System.out.println("Sending request inventory verification request:");
          RequestInventoryVerificationResponse response =
              omnichannelSettingsServiceClient.requestInventoryVerification(request);

          System.out.println("Omnichannel Setting after inventory verification request below:");
          System.out.println(response);
        } catch (Exception e) {
          System.out.println("An error has occured: ");
          System.out.println(e);
        }
      }

      public static void main(String[] args) throws Exception {
        Config config = Config.load();

        // The country which you're targeting at.
        String regionCode = "{REGION_CODE}";

        requestInventoryVerification(config, regionCode);
      }
    }

## View the status of an omnichannel setting.

To check the review status of the LIA onboarding reviews, check `ReviewState`
for corresponding attributes of `omnichannelSetting` returned by the
`omnichannelSettings.get` or `omnichannelSettings.list` methods.

The `ReviewState` field applies to all the onboarding reviews except the
inventory verification process, and can have the following values:

- `ACTIVE`: It is approved.
- `FAILED`: It is rejected.
- `RUNNING`: It is still under review.
- `ACTION_REQUIRED`: This only exists in the `InStock.state` for GHLSF merchants. It means you need to request inventory verification to make LIA serve.

`InventoryVerification.State` has the following values:

- `SUCCEEDED`: It is approved.
- `INACTIVE`: You're ready to request inventory verification.
- `RUNNING`: It is under review
- `SUSPENDED`: You have failed inventory verification too many times (usually 5), and need to wait before being able to request it again.
- `ACTION_REQUIRED`: You need to take additional actions before requesting inventory verification.

## Troubleshoot issues related to `Omnichannel Settings API`

This section describes how to troubleshoot common issues.

### Create an omnichannel setting

- Make sure to set both `LsfType` and `RegionCode`.
- If you choose `GHLSF`, provide an empty `InStock` in the request.
- If you choose Merchant-hosted LSF types, provide at least one URI in `InStock` or `Pickup`.

### Update an omnichannel setting

The update method for this resource requires the following additional rules:

- You cannot modify the region code.
- You cannot make updates while the LIA/FLL feature is running or has been approved.
- When changing from Merchant-hosted LSF types to `GHLSF`, if `InStock` and `Pickup` were previously configured, you must include them in the update mask along with the `LsfType` update.

For example, if you applied `MHLSF_BASIC` and `Pickup` before and they were
rejected, you are able to switch to `GHLSF` by sending a request like this:

    PATCH https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{REGION_CODE}?update_mask=lsf_type,in_stock,pickup

    {
      "lsfType": "GHLSF",
      "inStock": {},
    }

Replace the following:

- `{ACCOUNT_ID}`: The unique identifier of your Merchant Center account
- `{REGION_CODE}`: A region code as defined CLDR

### Request inventory verification

If, despite updating the product or inventory feeds and confirming the contact,
`InventoryVerification.state` is other than `INACTIVE`:

- For merchants in Austria, Germany, and Switzerland: Ensure that you have completed an About page review.
- There will be a delay of about 48 hours.
- In case of Repeated Inventory Check failures (more than five), the service enforces a thirty-day cooling-down period before allowing another request. Contact Google Support if you want to request it earlier.

## Learn more

For more details, see
[Local inventory ads and free local listings Help Center](https://support.google.com/merchants/topic/14607119?ref_topic=13421785,7259405,&sjid=11745184944808985048-NC).