get Shopify Cookiesutility
utility
Parses cookie string and returns Shopify cookies.
If the Shopify cookies doesn't exist, this method will return empty string for each missing cookie.
Anchor to getShopifyCookies-parametersParameters
string
required
ShopifyCookies
_shopify_s
string
Shopify session token: Value of cookie.
_shopify_y
string
Shopify unique user token: Value of cookie.
Was this section helpful?
Shopify cookies names
string
required
Shopify session token: Value of cookie.
string
required
Shopify unique user token: Value of cookie.
Was this section helpful?
Example code
import * as React from 'react';
import {useEffect} from 'react';
import {getShopifyCookies} from '@shopify/hydrogen';
export default function App({Component, pageProps}) {
useEffect(() => {
getShopifyCookies(document.cookie);
});
return <Component {...pageProps} />;
}