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 ^
User | RANK |
---|---|
2 | |
2 | |
2 | |
2 | |
2 |
Transform this holiday season into a shopping spree. Plus, learn how to effortlessly open ...
By Jasonh Dec 8, 2023Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023