Skip to main content

useShop

The useShop hook provides access to values within the shopify property in the hydrogen.config.js file. It must be a descendent of a ShopifyProvider component.

Example code

import {useShop} from '@shopify/hydrogen';

export default function MyPage() {
const {locale} = useShop();

return <h1>The locale is {locale}</h1>;
}

Return value

The useShop hook returns an object with the following keys:

KeyDescription
defaultCountryCodeThe defaultCountryCode from hydrogenConfig.shopify.
defaultLanguageCodeThe defaultLanguageCode from hydrogenConfig.shopify.
storeDomainThe store domain set in hydrogenConfig.shopify.
storefrontTokenThe Storefront API token set in hydrogenConfig.shopify.
storefrontApiVersionThe Storefront API version set in hydrogenConfig.shopify.