Shopify themes, liquid, logos, and UX
Hi there, the hyperlink on our Shopify cookie banner is wrong. If I click on "privacy policy" it sends me to the German web store but it should stay on the English web store.
How and where can I change this? See the screenshots
Hi @Baris ,
I have written custom JS to update the URL. Please add the below script on the theme.liquid file just above </body>
Follow these Steps:
1) Go to Online Store
2) Edit Code
3) Find theme.liquid file
4) Add the below code just above </body>
<script>
(function checkAndUpdateLink() {
const targetSelector = 'a#shopify-pc__banner__body-policy-link';
const checkInterval = 500; // Check every 500ms
const maxAttempts = 20000 / checkInterval; // Stop after 15 seconds
let attempts = 0;
function updateLink() {
const linkElement = document.querySelector(targetSelector);
if (linkElement) {
const baseUrl = window.location.origin;
let newHref = '';
if (baseUrl === 'https://gardenigloo.shop') {
newHref = 'https://gardenigloo.shop/policies/privacy-policy';
} else if (baseUrl === 'https://gardenigloo.fr') {
newHref = 'https://gardenigloo.fr/policies/privacy-policy';
}
if (newHref && linkElement.href !== newHref) {
linkElement.href = newHref;
}
} else if (attempts < maxAttempts) {
attempts++;
setTimeout(updateLink, checkInterval);
}
}
updateLink();
})();
</script>
Note: Please take backup of the original file so that you can revert the changes.
If you need any help adding this code on the site, you can let me know.
If you require further help to optimize your store, please don’t hesitate to reach out. If you find this information useful, a Like would be greatly appreciated. And if this solves the problem, please Mark it as Solution!
Best Regards,
Makka
Hi Makka, thank you for your efforts. We have activated the Shopify cookie banner and somewhere in the theme codes must be this wrong link which I want just to edit. I don`t want to add more codes in the theme because the other 2 stores (German and French) are working well. I could edit them via Translate & Adapt app. But I cannot find the "original code" for the English cookie which I am looking for.
Thank you for reaching out. Since you're using a paid theme, I don't have direct access to the code to pinpoint where the link needs to be updated. However, if you can provide more details or access, I'd be happy to guide you in the right direction.
I have sent you an email
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025