Shopify themes, liquid, logos, and UX
i Wanna Make Thius Code Copied In 1 Click..
URL: https://mrzkj1nl2c81f39s-55495491628.shopifypreview.com
Hello @Emiway
Are you want to copy the code in green color when user click on it ?
Am i right ?
If yes, then you only need to follow below steps:
1. Go to admin > Online Store > edit code.
2. In code directory, find the file named "theme.liquid" and open it.
3. Scroll down to and of the page and paste below code above body tag ends like this </body>.
<script>
function copyText(element) {
var text = element.textContent;
navigator.clipboard.writeText(text).then(function() {
console.log('Text copied to clipboard');
})
}
var element = document.querySelector('.text-with-icon span.text-sm');
element.addEventListener('click', function() {
copyText(this);
});
</script>
4. Don't forget to save the file after making changes.
Hope this code works for your issue.
If this code helpful to you, then just like and mark this solution as solved.
Not Working
Can you please share the store url so i can check what's the exact issue ?
where do you place above mentioned code in your theme ?
in theme.liquid
Then just remove that code from theme.liquid and paste in main-product.liquid file before schema starts.
not working
Can you please attach the actual screenshot of the code where you placed ?
I've checked and It is working fine on mobile and desktop.
It might be some cache issues. Try by clear all caches and try again
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025