Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies

Tuesday, August 16, 2022

Add a Message to the Shopify Product Pages by Using Product Tags

 

You can add a message to product pages using tags on your Shopify store, all you have to do is input the right codes in the right places. 

This tutorial would help you figure out how to add a message to Shopify product pages using code. 

Add A Message To Product Pages

Step 1:  Make a duplicate of your live theme 

Go to the Online Store > Themes > next to the live version of your theme click on Actions > Duplicate

 

 Step 2: Paste the code to the  product-template.liquid

Now that we have the duplicate of our live theme we can start coding. Click on Actions > Edit Code

From the navigation to the left scroll down to the Sections directory and choose product-template.liquid.

Paste the following code where you want your message to be shown, for example above Add to cart button.

 

 {% for tag in product.tags %} 

 {% if tag contains 'newMessage:' %} 

             {{ tag | remove:'newMessage:'}} 

     {% endif %} 

 {% endfor %}     

 

Click on Save!

 

 Step 3: Add message to your products 

From your Shopify admin click on Products and find the product you want to add a message to. On the right side you will see one small box with  tags. type "newMessage: " and your message. So for example we will go with "newMessage: Only available for in store pickup" and add a tag. Click on Save.

 

 Step 4: Check if everything is working properly 

Go to the online store, find the product and give yourself a big pat on the back!

 

No comments:

Post a Comment