More free tools:  InstantLinkHub· Feexio· SwiftConvertHub

How to Add a WhatsApp Button to Your WooCommerce Store (2026 Guide)

WhatsApp button on WooCommerce product page

WooCommerce gives you full control over your store — including the ability to add a WhatsApp button without installing a single plugin. This guide covers three practical methods using PHP hooks and direct HTML, plus how to craft dynamic pre-filled messages that include the product name automatically.

Why WooCommerce Sellers Need WhatsApp

Email response rates for e-commerce inquiries average around 20%. WhatsApp open rates are above 90%. That gap explains why more and more WooCommerce store owners are adding a direct messaging channel alongside their standard contact forms.

The use cases are concrete:

  • Abandoned cart recovery: A customer who left items in the cart but gave you their number during a previous order can be reached over WhatsApp. A short "Still interested in [product]?" message recovers carts that automated emails never reach.
  • Pre-purchase questions: Shoppers on mobile don't want to fill out a contact form and wait 24 hours. They want a quick answer about sizing, compatibility, or shipping before they commit. A WhatsApp button reduces friction at the exact moment of decision.
  • Trust signal: A study of mobile shoppers in Latin America and Southern Europe found that 40% of consumers prefer to ask a question via messaging over email before making an online purchase. Displaying a WhatsApp button tells hesitant buyers there's a real person behind the store.

The good news: WooCommerce is built on WordPress, which gives you fine-grained hooks to inject buttons exactly where you want them — no plugin overhead required.

Method 1: Add WhatsApp Button via Functions.php

This is the cleanest approach for developers. You add a small PHP function to your theme's functions.php file (or a site-specific plugin), hook it into WooCommerce's product page action, and the button appears automatically on every single product page — without touching any template file.

Step 1: Go to your WordPress admin → Appearance → Theme Editor (or use a child theme's functions.php). Paste the following at the bottom of the file:

/** * Add WhatsApp button to WooCommerce single product pages * Hook: woocommerce_single_product_summary (priority 35, after add-to-cart) */ add_action( 'woocommerce_single_product_summary', 'ilh_whatsapp_product_button', 35 ); function ilh_whatsapp_product_button() { global $product; // Replace with your WhatsApp-enabled number (international format, no + or spaces) $whatsapp_number = '15551234567'; $product_name = rawurlencode( $product->get_name() ); $message = rawurlencode( 'Hi, I\'m interested in ' ) . $product_name . rawurlencode( ' — can you help?' ); $whatsapp_url = 'https://wa.me/' . $whatsapp_number . '?text=' . $message; echo '<a href="' . esc_url( $whatsapp_url ) . '" target="_blank" rel="noopener noreferrer" class="button alt ilh-whatsapp-btn" style="background:#25D366;color:#fff;border-color:#25D366;margin-top:10px;display:flex;align-items:center;justify-content:center;gap:8px;"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 24 24"> <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/> </svg> Ask on WhatsApp </a>'; }

Step 2: Replace 15551234567 with your actual WhatsApp number in international format (country code first, no plus sign, no spaces). Save the file.

Step 3: Visit any product page on your store. The green "Ask on WhatsApp" button will appear below the Add to Cart button. When tapped on mobile, WhatsApp opens with the message "Hi, I'm interested in [exact product name] — can you help?" already typed.

The hook priority 35 places the button after the Add to Cart button (priority 30) but before the product meta (priority 40). Adjust the number if your theme positions things differently.

Method 2: Add WhatsApp Button to Product Description

If you don't want to edit PHP code, you can add the button directly inside a product's description using the WordPress block editor. This is ideal for featuring WhatsApp on specific products only — without touching the theme.

In the WooCommerce product editor, switch to the Text / HTML tab of the description field and paste:

<a href="https://wa.me/15551234567?text=Hi%2C%20I%27m%20interested%20in%20this%20product%20%E2%80%94%20can%20you%20help%3F" target="_blank" rel="noopener" style="display:inline-flex;align-items:center;gap:8px;background:#25D366; color:#fff;padding:12px 20px;border-radius:8px; text-decoration:none;font-weight:600;font-size:15px;"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 24 24"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/></svg> Ask on WhatsApp </a>

The limitation of this approach is that the message is static — it can't dynamically insert the product name. For a personalised message per product, use Method 1 or manually edit the text= parameter for each product.

Method 3: WhatsApp on the Checkout / Thank-You Page

Adding WhatsApp to the WooCommerce order confirmation (thank-you) page turns a passive receipt into an active support touchpoint. A customer who just placed an order and sees "Questions about your order? Chat on WhatsApp" is far more likely to reach out — and far less likely to file a chargeback without trying to resolve an issue first.

Add this to your functions.php:

add_action( 'woocommerce_thankyou', 'ilh_whatsapp_thankyou', 10, 1 ); function ilh_whatsapp_thankyou( $order_id ) { $order = wc_get_order( $order_id ); $whatsapp_number = '15551234567'; // your number $message = rawurlencode( 'Hi! I just placed order #' . $order_id . ' on your store. I have a quick question.' ); $url = 'https://wa.me/' . $whatsapp_number . '?text=' . $message; echo '<div style="margin:24px 0;padding:20px;background:#f0fdf4;border:1px solid #bbf7d0;border-radius:10px;"> <p style="margin:0 0 12px;font-weight:600;">Need help with your order?</p> <a href="' . esc_url( $url ) . '" target="_blank" rel="noopener" style="display:inline-flex;align-items:center;gap:8px;background:#25D366; color:#fff;padding:12px 20px;border-radius:8px;text-decoration:none;font-weight:600;"> Chat on WhatsApp </a> </div>'; }

The order number is injected automatically into the pre-filled message, so your customer service team immediately knows which order the conversation is about.

Crafting the Perfect Pre-filled Message

The pre-filled message is the difference between a customer who starts a conversation and one who abandons the click. Good pre-filled messages are specific, low-effort to send, and give you context before you reply.

The PHP snippet in Method 1 dynamically builds the message using $product->get_name(). So if the product is "Blue Merino Wool Scarf – Size M", the customer opens WhatsApp with:

Hi, I'm interested in Blue Merino Wool Scarf – Size M — can you help?

You can customise the message template to match your brand tone. Here are three variations for different store types:

  • Fashion/apparel: "Hi! I have a question about [product name] — sizing or availability?"
  • Electronics: "Hello, I'd like to confirm compatibility before ordering [product name]."
  • Handmade/custom: "Hi, I'm interested in [product name] — can I request a custom version?"

For the URL encoding to work correctly in PHP, always use rawurlencode() on both the static string and the product name. The urlencode() function encodes spaces as + which WhatsApp doesn't interpret correctly in the text= parameter — rawurlencode() uses %20 which works reliably.

Tracking WhatsApp Clicks with UTM Parameters

WhatsApp links open an external app, so they won't show up in your Google Analytics referral data on their own. The way to track them is to append UTM parameters to a landing page URL — but since the WhatsApp link itself opens the app rather than a page, the practical approach is to track the click event in GA4 via a JavaScript event listener, or to route customers through a tracked landing page before the WhatsApp redirect.

The simplest method is to add a data- attribute to your button and fire a GA4 event when it's clicked. Add this script anywhere after the button HTML:

<script> document.querySelectorAll('.ilh-whatsapp-btn').forEach(function(btn) { btn.addEventListener('click', function() { gtag('event', 'whatsapp_click', { 'event_category': 'engagement', 'event_label': document.title, 'utm_source': 'whatsapp', 'utm_medium': 'product_page' }); }); }); </script>

Alternatively, use InstantLinkHub's UTM Builder to create a tagged URL for a dedicated landing page (e.g., https://yourstore.com/contact/?utm_source=whatsapp&utm_medium=product_page&utm_campaign=product_inquiry) and link your WhatsApp button to that page first, with a redirect or chat widget on arrival.

Either approach lets you segment WhatsApp-driven traffic in GA4 and compare it to email, organic, and paid channels — useful data for deciding where to focus your customer communication efforts.

Speaking of measuring results: once you know which products drive the most WhatsApp conversations, you'll want to know your actual profit margin per order after payment processing fees. Feexio lets WooCommerce sellers calculate their net earnings after PayPal, Stripe, or other payment gateway fees — useful when deciding which products are worth promoting through high-touch channels like WhatsApp.

Frequently Asked Questions

Does adding WhatsApp to WooCommerce require a plugin?

No. All three methods in this guide use either PHP added to functions.php or plain HTML in the product description. No plugin is installed or activated. The button is a simple anchor tag pointing to wa.me — WhatsApp's official click-to-chat URL format.

Can I use the same WhatsApp number for all products?

Yes, and that's exactly what Method 1 does. The single PHP function hooks into all product pages simultaneously. The only thing that changes per product is the dynamic message text, which includes the product name automatically. Your WhatsApp number stays the same throughout.

How do I make the WhatsApp button appear on mobile only?

Add a CSS class to your button (e.g., class="ilh-whatsapp-btn") and add this rule to your theme's stylesheet or the WordPress Customizer's Additional CSS box:

@media (min-width: 768px) { .ilh-whatsapp-btn { display: none !important; } }

This hides the button on screens 768px and wider (typically desktops and tablets), while keeping it visible on mobile — where WhatsApp usage is most natural. Adjust the breakpoint to match your theme's mobile breakpoint if needed.

Generate your WhatsApp link

Create the link with your number and a custom pre-filled message, then paste it into your WooCommerce theme using the code above.

Create WhatsApp Link Free
VC

Victor A. Calvo S.

Software Engineer & Founder, InstantLinkHub

Victor A. Calvo S. is a software engineer and digital entrepreneur who builds practical, free tools for marketers, freelancers, and businesses worldwide. He is the creator of InstantLinkHub, Feexio, and SwiftConvertHub — three open-access platforms covering link generation, fee calculation, and unit conversion. Victor specialises in client-side web applications that respect user privacy: no accounts, no data collection, no paywalls. His writing focuses on making technical concepts accessible to non-developers — clear steps, no jargon.

WooCommerce te da control total sobre tu tienda, incluyendo la posibilidad de añadir un botón de WhatsApp sin instalar ningún plugin. Esta guía cubre tres métodos prácticos con PHP y HTML directo, además de cómo crear mensajes predefinidos dinámicos que incluyen el nombre del producto automáticamente.

Por qué los vendedores de WooCommerce necesitan WhatsApp

La tasa de respuesta media del email en e-commerce ronda el 20%. Las tasas de apertura de WhatsApp superan el 90%. Esa diferencia explica por qué cada vez más propietarios de tiendas WooCommerce añaden un canal de mensajería directo.

Los casos de uso son concretos:

  • Recuperación de carritos abandonados: Un cliente que dejó artículos en el carrito pero te dio su número en un pedido anterior puede ser contactado por WhatsApp. Un breve "¿Sigues interesado en [producto]?" recupera carritos que los emails automatizados nunca alcanzan.
  • Preguntas antes de comprar: Los compradores móviles no quieren rellenar un formulario y esperar 24 horas. Quieren una respuesta rápida sobre talla, compatibilidad o envío antes de decidirse. Un botón de WhatsApp reduce la fricción en el momento exacto de la decisión.
  • Señal de confianza: El 40% de los compradores móviles prefieren preguntar por mensajería antes que por email antes de realizar una compra online. Mostrar un botón de WhatsApp indica a los compradores indecisos que hay una persona real detrás de la tienda.

Método 1: Añadir el botón mediante functions.php

Este es el enfoque más limpio para desarrolladores. Añades una pequeña función PHP al archivo functions.php de tu tema, la enganchas al hook de producto de WooCommerce y el botón aparece automáticamente en todas las páginas de producto.

Ve a WordPress Admin → Apariencia → Editor de temas (o usa el functions.php de un tema hijo). Pega lo siguiente al final del archivo:

add_action( 'woocommerce_single_product_summary', 'ilh_whatsapp_product_button', 35 ); function ilh_whatsapp_product_button() { global $product; // Reemplaza con tu número en formato internacional (sin + ni espacios) $whatsapp_number = '34612345678'; $product_name = rawurlencode( $product->get_name() ); $message = rawurlencode( 'Hola, me interesa ' ) . $product_name . rawurlencode( ' — ¿me puedes ayudar?' ); $whatsapp_url = 'https://wa.me/' . $whatsapp_number . '?text=' . $message; echo '<a href="' . esc_url( $whatsapp_url ) . '" target="_blank" rel="noopener noreferrer" class="button alt ilh-whatsapp-btn" style="background:#25D366;color:#fff;border-color:#25D366;margin-top:10px;"> Preguntar en WhatsApp </a>'; }

Sustituye 34612345678 por tu número real de WhatsApp en formato internacional (código de país primero, sin símbolo +, sin espacios). Guarda el archivo y visita cualquier página de producto — el botón verde aparecerá debajo de "Añadir al carrito".

Método 2: Botón en la descripción del producto

Si no quieres editar PHP, puedes añadir el botón directamente en la descripción del producto usando el editor de WordPress. Ideal para destacar WhatsApp en productos específicos sin tocar el tema.

En el editor de producto de WooCommerce, cambia a la pestaña HTML y pega:

<a href="https://wa.me/34612345678?text=Hola%2C%20me%20interesa%20este%20producto%20%E2%80%94%20%C2%BFme%20puedes%20ayudar%3F" target="_blank" rel="noopener" style="display:inline-flex;align-items:center;gap:8px;background:#25D366; color:#fff;padding:12px 20px;border-radius:8px; text-decoration:none;font-weight:600;"> Preguntar en WhatsApp </a>

La limitación de este método es que el mensaje es estático — no puede insertar el nombre del producto dinámicamente. Para mensajes personalizados por producto, usa el Método 1 o edita manualmente el parámetro text= en cada producto.

Método 3: WhatsApp en la página de confirmación de pedido

Añadir WhatsApp a la página de agradecimiento de WooCommerce convierte un recibo pasivo en un punto de contacto de soporte activo. Añade esto a tu functions.php:

add_action( 'woocommerce_thankyou', 'ilh_whatsapp_thankyou', 10, 1 ); function ilh_whatsapp_thankyou( $order_id ) { $whatsapp_number = '34612345678'; $message = rawurlencode( 'Hola, acabo de hacer el pedido #' . $order_id . ' y tengo una consulta rápida.' ); $url = 'https://wa.me/' . $whatsapp_number . '?text=' . $message; echo '<div style="margin:24px 0;padding:20px;background:#f0fdf4;border:1px solid #bbf7d0;border-radius:10px;"> <p style="margin:0 0 12px;font-weight:600;">¿Necesitas ayuda con tu pedido?</p> <a href="' . esc_url( $url ) . '" target="_blank" rel="noopener" style="display:inline-flex;align-items:center;gap:8px;background:#25D366; color:#fff;padding:12px 20px;border-radius:8px;text-decoration:none;font-weight:600;"> Chatear en WhatsApp </a> </div>'; }

El número de pedido se inyecta automáticamente en el mensaje predefinido, lo que permite a tu equipo de atención al cliente identificar de inmediato de qué pedido trata la conversación.

El mensaje predefinido perfecto

El snippet de PHP del Método 1 construye el mensaje dinámicamente usando $product->get_name(). Si el producto se llama "Bufanda de Lana Merino Azul – Talla M", el cliente abre WhatsApp con:

Hola, me interesa Bufanda de Lana Merino Azul – Talla M — ¿me puedes ayudar?

Usa siempre rawurlencode() en PHP para codificar el mensaje. La función urlencode() codifica los espacios como +, que WhatsApp no interpreta correctamente en el parámetro text=. rawurlencode() usa %20, que funciona de forma fiable.

Seguimiento de clics de WhatsApp con UTM

Los enlaces de WhatsApp abren una app externa, por lo que no aparecerán en los datos de referencia de GA4. La forma más sencilla de rastrearlos es añadir un listener de eventos en JavaScript:

<script> document.querySelectorAll('.ilh-whatsapp-btn').forEach(function(btn) { btn.addEventListener('click', function() { gtag('event', 'whatsapp_click', { 'event_category': 'engagement', 'event_label': document.title, 'utm_source': 'whatsapp', 'utm_medium': 'product_page' }); }); }); </script>

También puedes usar el Constructor de UTM de InstantLinkHub para crear una URL etiquetada para una página de destino dedicada con utm_source=whatsapp&utm_medium=product_page.

Una vez que sepas qué canal genera más ingresos, usa Feexio para calcular tus ganancias netas por pedido después de las comisiones de PayPal, Stripe u otras pasarelas de pago.

Preguntas frecuentes

¿Añadir WhatsApp a WooCommerce requiere un plugin?

No. Los tres métodos de esta guía usan PHP añadido a functions.php o HTML directo en la descripción del producto. No se instala ni activa ningún plugin. El botón es un simple enlace que apunta a wa.me, el formato oficial de URL de WhatsApp para click-to-chat.

¿Puedo usar el mismo número de WhatsApp para todos los productos?

Sí, y eso es exactamente lo que hace el Método 1. La función PHP se engancha a todas las páginas de producto simultáneamente. Lo único que cambia por producto es el texto del mensaje dinámico, que incluye el nombre del producto automáticamente. Tu número de WhatsApp permanece igual en toda la tienda.

¿Cómo hago que el botón de WhatsApp aparezca solo en móvil?

Añade una clase CSS al botón (p. ej., class="ilh-whatsapp-btn") y añade esta regla a la hoja de estilos de tu tema o en el CSS adicional del Personalizador de WordPress:

@media (min-width: 768px) { .ilh-whatsapp-btn { display: none !important; } }

Esto oculta el botón en pantallas de 768px o más (normalmente escritorio y tablet), manteniéndolo visible en móvil, donde el uso de WhatsApp es más natural.

Genera tu enlace de WhatsApp

Crea el enlace con tu número y un mensaje predefinido personalizado, y luego pégalo en tu tema de WooCommerce con el código anterior.

Crear enlace de WhatsApp gratis
VC

Victor A. Calvo S.

Ingeniero de software y fundador, InstantLinkHub

Victor A. Calvo S. es un ingeniero de software y emprendedor digital que construye herramientas prácticas y gratuitas para marketers, freelancers y empresas de todo el mundo. Es el creador de InstantLinkHub, Feexio y SwiftConvertHub. Su escritura se enfoca en hacer los conceptos técnicos accesibles para no desarrolladores: pasos claros, sin jerga.