--- title: getShopifyCookies description: Parses cookie string and returns Shopify cookies. api_version: 2026-04 api_name: hydrogen source_url: html: https://shopify.dev/docs/api/hydrogen/2024-01/utilities/getshopifycookies md: https://shopify.dev/docs/api/hydrogen/2024-01/utilities/getshopifycookies.md --- # getShopifyCookies Parses cookie string and returns Shopify cookies. For tracking values, consider using `getTrackingValues` instead, which reads from modern Shopify cookies. ## get​Shopify​Cookies(**[cookies](#getshopifycookies-propertydetail-cookies)**​) Gets the values of \_shopify\_y and \_shopify\_s cookies from the provided cookie string. If the Shopify cookies doesn't exist, this method will return an empty string for each missing cookie. ### Parameters * **cookies** **string** **required** ### Returns * **ShopifyCookies** ### ShopifyCookies Shopify cookies names * \_shopify\_s Shopify session token: Value of \`\_shopify\_s\` cookie. ```ts string ``` * \_shopify\_y Shopify unique user token: Value of \`\_shopify\_y\` cookie. ```ts string ``` #### ShopifyCookies Shopify cookies names * **\_shopify\_s** **string** **required** Shopify session token: Value of `_shopify_s` cookie. * **\_shopify\_y** **string** **required** Shopify unique user token: Value of `_shopify_y` cookie. Examples ### Examples * #### Example code ##### JavaScript ```jsx 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 ; } ``` ##### TypeScript ```tsx 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 ; } ``` *** ## Related [- useShopifyCookies](https://shopify.dev/docs/api/hydrogen/2026-04/hooks/useshopifycookies) [- getTrackingValues](https://shopify.dev/docs/api/hydrogen/2026-04/utilities/gettrackingvalues) ***