Change Woocommerce '' Addtocart '' button by another link

TheOne-sama

Newbie
Joined
Jan 4, 2021
Messages
41
Reaction score
24
Hello guys,

I need your help on this.

I want to change my woocommerce shop '' Add to cart '' buttons to '' Chat with the seller on WhatsApp '' or '' Chat with the seller on Telegram ''.

The behavior I need is :

When the customer clicks on the button, Product title, price, short description and link is copied on the backend and pasted in the message bar of the customer's social app.
For example, when you share a WordPress article on whatsapp, it copy automatically the article image, the title, an excerpt and the link to the article before sharing in an inbox.

I need the same behavior with other informations simply so the customer can tell me directly in which product he/she is interested without additional work.
 
You need to override the "add to cart" html in /your-theme/woocommerce/single-product/add-to-cart/ files. This will do the trick on product pages for sure. You can grab the product title using jQuery and add that to your WhatsApp URL.
 
I am a complete noob in programming man... How do I do that
 
I am a complete noob in programming man... How do I do that
It's not programming, just common sense. Check your website files then follow his directions. When he said override, he meant to just replace the link with the telegram one. simple copy paste task.
 
For the jQuery part, a quick google search would make you find the command to get the product name.
 
When he said override, he meant to just replace the link with the telegram one. simple copy paste task.
I think you got me wrong. If is was a simple link exchange there is no big deal.

The part where you get product details and attach them to the WhatsApp or Telegram link with jQuery is what i need.
 
Okay i'm going to check right now
Well, it's not that easy especially if you don't know how to program. I'm gonna do you a huge favor though. Only because I was bored lol. Just place this at the bottom of your theme's functions.php and of course replace the phone number. Tested and it works!
 

Attachments

Well, it's not that easy especially if you don't know how to program. I'm gonna do you a huge favor though. Only because I was bored lol. Just place this at the bottom of your theme's functions.php and of course replace the phone number. Tested and it works!

Man you just killed it. You do not know how grateful I am. :) Thank you lepman !!!
 
Back
Top