Locale APIAPIs
APIs
The Locale API allows the extension to retrieve the merchant's locale.
Anchor to localeapiLocaleApi
Anchor to subscribable
subscribable
RemoteSubscribable<string>
required
IETF-formatted locale at time of page load and a callback to subscribe to value changes. Current supports only one subscription. You can utilize on a
to implement multiple subscriptions. Using
or the corresponding hooks counts as a subscription.
Was this section helpful?
Anchor to examplesExamples
Examples of using the Locale API
Anchor to example-subscribe-to-locale-changes.Subscribe to locale changes.
Was this section helpful?
Subscribe to locale changes.
import React from 'react';
import {
reactExtension,
useLocaleSubscription,
useApi,
Tile,
} from '@shopify/ui-extensions-react/point-of-sale';
const SmartGridTile = () => {
const locale = useLocaleSubscription();
return (
<Tile
title='My App'
subtitle={locale}
enabled
/>
);
};
export default reactExtension('pos.home.tile.render', () => <SmartGridTile />);