Question: How to add whatsapp button that add URL of product page in chat.
theme: sense
Question: How to add whatsapp button that add URL of product page in chat.
theme: sense
Hi @rzwahmed
To add a WhatsApp chat button on your Shopify product pages that includes the product title and URL in the message, follow these steps:
In your Shopify admin, go to Online Store > Themes.
Find the theme you want to edit, click the âActionsâ dropdown, and select âEdit codeâ.
In the theme code editor, open the product-template.liquid file located in the Sections folder.
Find a good spot to insert the WhatsApp button code, like below the add to cart button. Paste this code:
Hereâs what each part does:
The <a> tag creates a link that opens WhatsApp with a pre-filled message.
You have to replace url-to-whatsapp with the real url (like in your actual button)
You have to put your phone number
{{ product.title | url_encode }} inserts the product name and encodes it properly for a URL.
{{ shop.url }}{{ product.url }} adds the full URL to that specific product page.[1]
Replace whatsapp-icon.png with the path to your own WhatsApp button image.
Click âSaveâ and the WhatsApp button will now show up on your product pages!
When a customer clicks it, WhatsApp will open with a message like:
âIâm interested in the product: Awesome T-Shirt - https://yourstore.com/products/awesome-tshirtâ
The product title and URL are pulled in dynamically for each product.[1]
Some tips:
<a> tag.Let me know if you have any other questions.
Hello @rzwahmed ,
It looks like you are using the WhatsApp Chat & Abandoned Cart app and are trying to pass the product URL to the WhatsApp chat widget. The app provides this feature where you can add the page link in the default message. For that, you would need to follow these steps:
Open the WATI App: WhatsApp Chat app from the Shopify admin panel. You can check the screenshot below for more reference.
The app dashboard will open, From the tabs on the left select the Whatsapp chat option, as shown in the screenshot below:
Scroll down to Chat Widget settings. In the âPrefilled Messageâ field you can enter your desired message and add the link using the Page Link button. You can check the message I added in the screenshot below:
In case youâre still unable to add the product page link, I suggest you kindly reach out to the WATI app support by clicking on the chatbot icon on the bottom-right corner of the screen.
Hope this helps!
Regards,
Abhishek from Swym
Sorry, Iâve made a mistake. The Sense theme for Shopify does not have a file named product-template.liquid. Instead, it uses main-product.liquid located in the Sections folder to render the product page.
To find and edit the code for the product page in the Sense theme, you need to follow these steps:
Online Store > Themes.Actions > Edit code.Sections folder.main-product.liquid file.This main-product.liquid file contains the Liquid code that generates the product page layout and functionality. You can modify this file to customize the product page with your whatsapp button.
Yes, I have used WATI to create whatapp widget, but not by using WhatsApp Chat & Abandoned Cart app, but i used online code creation tool from here
And also used option to include page title and URL
âmessageTextâ:âHello, %0A I have a question about {{page_title}}{{page_link}}â,
But this code in not adding page title and page link in chat.
Here is code that I pated in theme.liquid
Hello @rzwahmed ,
Thank you for sharing your approach. It seems like youâve followed the correct steps in setting up your WhatsApp widget using WATI. However, if youâre encountering issues despite following the recommended approach, itâs best to reach out to the WATI team directly for further assistance.
Given that youâve utilized WATIâs custom code creation tool and included specific options, the WATI team would be in the best position to provide you with tailored support and troubleshooting for your setup. They can offer insights and solutions specific to their platform, ensuring a more effective resolution to any issues youâre facing.
Hope this helps!
Regards,
Abhishek from Swym