Urgent.News

What's breaking now, across thousands of outlets.

Tech

WooCommerce Order Updates on WhatsApp: 6 Bugs I’d Watch For

Sending a WhatsApp message when a WooCommerce order changes status sounds like a 10-line job. In production, these six problems show up first. Sending inside the request If you call the WhatsApp API directly inside woocommerce_order_status_changed, a slow API response slows down checkout or the admin order screen. Push the work to Action Scheduler with as_enqueue_async_action() instead. The same…

Sending a WhatsApp message upon WooCommerce order status changes may seem straightforward, but in practice, six issues can cause problems. Directly calling the WhatsApp API within the woocommerce_order_status_changed hook can hinder checkout speed or the admin order screen. To avoid this, offload the task to Action Scheduler by utilizing as_enqueue_async_action().

Avoid sending the same message twice, especially when moving an order from processing to on-hold and back. To prevent this, store a meta flag, like _wa_sent_processing, and verify it before sending the message.

Customers may enter phone numbers in various formats, such as “098765 43210”, “+91-98765-43210”, or lacking the country code. Standardize inputs by normalizing the billing country, removing non-digit characters, and eliminating the leading zero.

Soliciting consent before sending messages is crucial to maintain a quality rating for your phone number. Include an opt-in checkbox at checkout, store the preference in order meta, and check it before every message send.

WhatsApp templates that exceed a purely transactional tone can be classified as marketing. To keep costs low, ensure order templates remain strictly transactional, such as “Your order shipped! Use code SAVE10 on your next order”.

Lastly, WhatsApp API messages may return a message ID even if delivery fails later. To address this, subscribe to the status webhook, log the result in order notes, and fall back on WooCommerce email for failed deliveries. If building and maintaining this system seems burdensome, consider using Wabbiyo, a WordPress plugin that supports the official WhatsApp Cloud API with a free plan: Click here to learn more.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Understanding Flask Environment, Security, and Error Handling

Understanding Flask Environment, Security, and Error Handling 🚀 _**When building a Flask application, separating Development (your local machine) from Production (the live server like Render) is one…

  • Environment variables securely manage sensitive configurations in Flask apps.
  • Debug mode varies between local development and production environments.
  • Flask error handling distinguishes between developer logs and user-facing messages.

More from Friday 16 October →