insert text above 'add to cart' button on product pages

Highlighted
New Member
2 0 0

Hi all,

 

Im hoping someone can help.

 

I am looking to add text, specifically 'free 72hr delivery guaranteed!' above the 'add to cart' button on my product page (link attached below).

 

https://apexbikingaccessories.co.uk/products/inbike-anti-shear-thief-deterrent-bike-lock

 

I want this to do the same on all product pages.

 

Please can someone advise/ offer a solution?

 

Thanks,

Jack

@apexbikingaccessories

0 Likes
Highlighted
Astronaut
1085 178 213

Hey,

1. In your Shopify Admin go to online store > themes > actions > edit code
2. In your theme.liquid file, find the </body> (press CTRL + F or command + F on Mac)
3. paste this code right above the </body> tag:



 

<script>
function addText(){

var fontSize = 20;
var text = `free 72hr delivery guaranteed!`;

var atc = document.getElementById(`AddToCart-product-template`);
if (!atc) return;


var html = `<p class="custom-atc-text" style="text-align:center;font-size:${fontSize}px;">${text}</p>`
atc.insertAdjacentHTML(`beforebegin`, html)

}

addText();
</script>

 


you can change the "text" and "fontSize" values to your liking.

Let me know how it goes.

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes