Skip to main content

useShopifyCookies

Sets Shopify user and session cookies and refreshes the expiry time.

Manages Shopify cookies. If hasUserConsent option is false, Shopify cookies will be removed.

Was this section helpful?

Example code

import * as React from 'react';
import {useShopifyCookies} from '@shopify/hydrogen';

export default function App({Component, pageProps}) {
useShopifyCookies({hasUserConsent: false});

return <Component {...pageProps} />;
}