Alokai
You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x

getCountryRegions

Get list of available regions for the provided country from SAP Commerce Cloud.

This method receives data from the getCountryRegions endpoint exposed by the SAP OCC API Countries Controller.

Signature

export declare function getCountryRegions(
	context: SapccIntegrationContext,
	props: GetCountryRegionsProps
): Promise<RegionList>;

Parameters

NameRequiredTypeDescription
contextRequiredSapccIntegrationContext
propsRequiredGetCountryRegionsPropsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns a list of country regions.

Referenced Types

Examples

Fetching a list of available country regions for a specific countryIsoCode.

import { sdk } from '~/sdk';

const category = await sdk.commerce.getCountryRegions({ countryIsoCode: 'US' });

Using the method the way it will be possible to cache the response.

import { sdk } from '~/sdk';

const category = await sdk.commerce.getCountryRegions({ countryIsoCode: 'US', lang: 'en', currency: 'GBP' });

Fetching a list of available country regions for a specific countryIsoCode and selecting response fields.

import { sdk } from '~/sdk';

const category = await sdk.commerce.getCountryRegions({ countryIsoCode: 'US', fields: 'regions(name,isocode)' });

On this page