Boost conversions with direct WhatsApp access from product pages. This premium snippet adds a professional WhatsApp button that auto-populates with product details, creating seamless communication between you and potential customers. The button features elegant hover effects and matches Shopify's native styling.
Automatically includes product title and URL in WhatsApp message
Easily configure WhatsApp number through theme settings
Professional WhatsApp green color with elegant hover effects
Perfectly responsive design for all devices极速p>
{% comment %} WhatsApp Button Under Buy Now Button Adds a WhatsApp button that sends product details when clicked {% endcomment %} {% assign whatsapp_number = "447308243564" %} {% assign message = "Hello, I'd like to buy " | append: product.title | append: " priced at " | append: product.price | money_with_currency | append: ". Here's the link: " | append: shop.url | append: product.url %} <div style="margin-top: 15px;"> <a href="https://api.whatsapp.com/send?phone={{ whatsapp_number }}&text={{ message | url_encode }}" class="button button--full-width" style="margin-top:10px; background:#25D366; color:white; text-align:center; padding:12px; border-radius:6px; display:block; font-weight:bold;" target="_blank" rel="noopener" > 🟢 Buy on WhatsApp </a> </div> <style> .whatsapp-button:hover { background-color: #128C7E !important; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); } </style>
From your Shopify admin, navigate to Online Store → Themes → Click "Actions" → Select "Edit code"
In the code editor, find your product template file (usually sections/main-product.liquid
or templates/product.liquid
)
Search for the code that generates your "Add to Cart" or "Buy Now" button (look for {%- when 'buy_buttons' -%}"
or similar)
Insert the provided code snippet immediately after the buy button code block
Change the whatsapp_number
variable in the code to your actual WhatsApp number with country code (e.g., 15551234567)
Save your changes and test the button on a product page to ensure it works correctly
Pro Tip: For better results, customize the button text and colors to match your store's branding. Test the button on both desktop and mobile devices to ensure it works correctly.