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

getCountryRegions

Method fetching a list of available regions for the provided country from SAP Commerce Cloud.

This method sends a GET request to the getCountryRegions endpoint of the Alokai Middleware. In turn, it receives data from the getCountryRegions endpoint exposed by the SAP OCC API Countries Controller.

Signature

export declare function getCountryRegions<Res extends RegionList = RegionList,
	Props extends GetCountryRegionsProps = GetCountryRegionsProps>(
	props: Props,
	options?: MethodOptions
): Promise<Res>;

Parameters

NameRequiredTypeDescription
propsRequiredPropsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.
optionsOptionalMethodOptionsOptions that can be passed to additionally configure the request or customize the logic in a plugin.

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