Integrate consent with checkout
This guide is designed to help customers gather consent when customers checkout from their Shopify shop.
Last updated
This guide is designed to help customers gather consent when customers checkout from their Shopify shop.
Last updated
This courtesy guide is no longer actively tested by Openli, although it might still work.
Our cookie-consent widget intentionally uses a highly-compatible, highly-generic approach to integration. In most cases, it will be possible for your developers to adapt this guide's steps to any changes that might have been made to the target platform, in combination with their own general documentation. Our consent-state events might be useful for this.
Before following these steps, please be sure that you have:
To install your widget, you'll need your widget code snippet.
To find your code snippet, go to the Openli dashboard and select "Widgets" in the side menu. Click on the Signup-widget you previously created and copy the code.
It will look like this:
Notice that the value for widgetPublicKey
will be different in your code snippet
The code snippet consists of two elements: the <script> code and a <div> element. The <div> element is replaced by our consent element, and thus must be placed where you wish to collect consent.
Your code snippet might need customisation to fit your page. Make sure you've about read all the options available in the consent widget.
There are a few places you need to hook into to enable Openli to work with Shopify. The first place is your cart, which you must edit in the theme code. Go to "Online Store", then "Themes", and then click "Actions" and select "Edit code".
Where your cart's template code is stored depends on the theme. In the default theme "Debut" it is located in a file called cart-template.liquid
.
When you have located the template code for your cart, you should add the code snippet:
The target element for consent collection (the <div>
in the example above) must be within the cart's form
element.
Remember to save your changes.
To reliably identify the user and ensure that their consent is properly associated with them, we need to add some code to your checkout completion page. This is done under "Settings", then "Checkout", where you should find the section called "Order processing".
You should see an input field for "Additional scripts", and that is where you should customise and insert the following code:
Congratulations on completing your first step towards collecting compliant consent. Pad your self on the back and know that our mascot Li is proud of you.