Personalized checkout and custom promotions with Shopify Scripts
I am looking for a solution to exclude the email info@vanea-barfussschuhe.com from translating when using Google Translate on the entire shopify store. The reason is, it becomes info@vanea-barfussschuh.com and does not match the data in GMC (google merchant center), which results in a policy violation… I am using the Sense theme from Shopify.
I have already tried the following, but none worked or maybe I did it incorrectly, I have limited experience but I must resolve this, so any help would be highly appreciated.
Solved! Go to the solution
This is an accepted solution.
Found the solution. If anyone is interested, here's how I achieved it for all instances (footer, rich text h4, and mailto links)
<script> document.addEventListener('DOMContentLoaded', function() { // Handle instances of the email address and URL within <p> tags var pElements = document.body.querySelectorAll('p'); pElements.forEach(function(el) { if (el.innerHTML.includes('info@vanea-barfussschuhe.com')) { el.innerHTML = el.innerHTML.replace('info@vanea-barfussschuhe.com', '<span class="notranslate"> info@vanea-barfussschuhe.com </span>'); } if (el.innerHTML.includes('https://vanea-barfussschuhe.com')) { el.innerHTML = el.innerHTML.replace('https://vanea-barfussschuhe.com', '<span class="notranslate">https://vanea-barfussschuhe.com</span>'); } }); // Handle the <h4> tag in the .rich-text__text class on the homepage var h4Elements = document.body.querySelectorAll('.rich-text__text h4'); h4Elements.forEach(function(el) { if (el.innerHTML.includes('info@vanea-barfussschuhe.com')) { el.innerHTML = el.innerHTML.replace('info@vanea-barfussschuhe.com', '<span class="notranslate">info@vanea-barfussschuhe.com</span>'); } }); // Handle the email links in a.c-link var linkElements = document.body.querySelectorAll('a.c-link'); linkElements.forEach(function(el) { if (el.innerHTML.includes('info@vanea-barfussschuhe.com')) { el.innerHTML = el.innerHTML.replace('info@vanea-barfussschuhe.com', '<span class="notranslate"> info@vanea-barfussschuhe.com</span>'); } }); }); </script>
in theme.liquid at the very end ^
This is an accepted solution.
Found the solution. If anyone is interested, here's how I achieved it for all instances (footer, rich text h4, and mailto links)
<script> document.addEventListener('DOMContentLoaded', function() { // Handle instances of the email address and URL within <p> tags var pElements = document.body.querySelectorAll('p'); pElements.forEach(function(el) { if (el.innerHTML.includes('info@vanea-barfussschuhe.com')) { el.innerHTML = el.innerHTML.replace('info@vanea-barfussschuhe.com', '<span class="notranslate"> info@vanea-barfussschuhe.com </span>'); } if (el.innerHTML.includes('https://vanea-barfussschuhe.com')) { el.innerHTML = el.innerHTML.replace('https://vanea-barfussschuhe.com', '<span class="notranslate">https://vanea-barfussschuhe.com</span>'); } }); // Handle the <h4> tag in the .rich-text__text class on the homepage var h4Elements = document.body.querySelectorAll('.rich-text__text h4'); h4Elements.forEach(function(el) { if (el.innerHTML.includes('info@vanea-barfussschuhe.com')) { el.innerHTML = el.innerHTML.replace('info@vanea-barfussschuhe.com', '<span class="notranslate">info@vanea-barfussschuhe.com</span>'); } }); // Handle the email links in a.c-link var linkElements = document.body.querySelectorAll('a.c-link'); linkElements.forEach(function(el) { if (el.innerHTML.includes('info@vanea-barfussschuhe.com')) { el.innerHTML = el.innerHTML.replace('info@vanea-barfussschuhe.com', '<span class="notranslate"> info@vanea-barfussschuhe.com</span>'); } }); }); </script>
in theme.liquid at the very end ^
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024