Skip to content

How to activate a cookie banner on the Shopify checkout page: Current restrictions and solutions

Due to the current limitations with the Shopify checkout UI extensions, it is not possible to add a cookie consent banner directly on the checkout page. However, you can still effectively manage cookie consent to remain GDPR compliant. In this guide, we'll show you how to display the banner on other pages and use the Shopify Customer Privacy API to apply the consent settings on the checkout page as well. This will ensure a seamless and compliant user experience.

Please note that we actively monitor Shopify updates to take future changes into account.

Limitations of the Shopify checkout UI extensions

Shopify has recently introduced checkout UI extensions to improve the customization capabilities of the checkout page. These extensions are based on predefined components, which means that only a fixed list of Shopify tools can be used for customization. Unfortunately, this list does not support JavaScript or script tags (neither inline nor remote).

Further details on this restriction can be found in the Shopify documentation:

Since JavaScript is not allowed, we cannot use script tags to display an interactive cookie banner or make custom changes directly to the checkout page. Manipulating the DOM to show pop-ups or other interactive content for cookie consent is also excluded.

Effects on obtaining consent

While this restriction may seem limiting, keep in mind that users will typically visit several other pages on your Shopify site before reaching the checkout. This gives you numerous opportunities to obtain cookie consent on other pages with your banner. Since these consents are captured and tracked on the pages, users don't have to see the banner again on the checkout page.

Use of the Shopify Customer Privacy API

Although we cannot run custom JavaScript on the checkout page, we can still effectively manage users' consent settings using the Shopify Customer Privacy API. This API provides a method to retrieve the consent status that users have provided on previous pages. This allows you to comply with GDPR requirements.

How to use the Shopify Customer Privacy API

Currently, the best approach for a GDPR compliant Shopify store setup is as follows:
  1. Read the Customer Privacy API documentation
    The Shopify API documentation provides detailed steps on how to access and use the Customer Privacy API. You can find the documentation here: Shopify Customer Privacy API.
  2. Retrieve consent status with the API
    After a user has interacted with the cookie banner on another page of your website, you can use this API to retrieve the consent status. This way, your backend system knows what the user's preferences are, even if no banner is displayed on the checkout page.
  3. Synchronize with your cookie banner
    Your cookie banner should automatically update the consent values as soon as a selection is made. By synchronizing these values with the Shopify Customer Privacy API, you ensure that the consent settings are reflected in all parts of the user journey, including the checkout page.

In this way, you remain compliant with the GDPR without having to place a banner on the checkout page itself.

Although Shopify currently restricts the placement of cookie banners on the checkout page, you can display the banner on other pages and use the Customer Privacy API to remain GDPR compliant. This solution will keep your store user-friendly and compliant until Shopify offers further customization options.
Previous article How to customize the font of your cookie banner in Shopify
Next article How to set up Google Consent Mode: A simple guide