Skip to content
Docs
Get RestroPress

Restropress- Whatsapp Order

Updated 4 min read
On this page

Whatsapp Order adds an "Order on WhatsApp" button to the RestroPress checkout page. When a customer presses it, WhatsApp opens (in a new tab) with a pre-written message addressed to your store's WhatsApp number. The message contains the customer's name and phone number, the order date, the service type and time, the delivery address, every cart item with add-ons and notes, and the subtotal, tax, discount and total.

Important to understand: this does not create an order in RestroPress. The customer sends a chat message, and you handle the order from WhatsApp. It is meant for restaurants that take orders and payment through chat.

Requirements#

  • RestroPress, active. The extension shows an admin error and deactivates itself if it is not.
  • A WhatsApp number (the readme suggests a WhatsApp Business number) that customers can message.
  • Version 1.1 is documented here. The readme lists WordPress 4.0 or later and "Tested up to: 6.8.2".

Installation#

  1. Go to Plugins › Add New › Upload Plugin, choose the ZIP and select Install Now.
  2. Select Activate.
  3. Open RestroPress › Settings › General › whatsapp and configure it.

The code contains no licence field and no update checker.

Settings#

Go to RestroPress › Settings › General and open the section labelled whatsapp (lower case in the code).

SettingWhat it doesDefault
EnableCheckbox "Check this to enable whatsapp." When off, no button is shown.Off
Whatsapp Number"Store Whatsapp Number." Placeholder +91874563210. Used as the phone parameter of the WhatsApp link, so enter the full international number; see Troubleshooting for the format.Empty
Order Text"Order button text." The label of the button. Placeholder "Order on WhatsApp".Empty (the button has no label until you fill this in)
Order OptionsBoth Checkout and Whatsapp order keeps the normal checkout and adds the WhatsApp button. Whatsapp order Only removes the normal checkout button and hides the payment mode selector, payment form and payment icons.Both Checkout and Whatsapp order

The values are stored in the option rp_whatsapp, separate from the main RestroPress settings.

The whatsapp section of RestroPress general settings

How it works#

Customer

  1. On the checkout page, below the purchase form, a box titled "Order on Whatsapp" appears with Name and Phone fields (pre-filled for logged-in customers from their account and saved phone) and your button.
  2. When the customer presses the button, the script collects the name, phone and the street, apartment, city and postcode typed into the checkout form, then asks the server for the message text.
  3. The server builds the message from the current cart and the service_type, service_time and delivery_date cookies. The address line is added only when the service type is delivery.
  4. WhatsApp opens in a new browser tab with that message ready to send. On phones and tablets the link uses api.whatsapp.com; on desktops it uses web.whatsapp.com. The customer must press send.
The Order on Whatsapp box on the checkout page

Restaurant

You receive the message in WhatsApp. Nothing is added to RestroPress › Orders, no email is sent, and no payment is taken. The message lists the payment method as COD in the code but this text is not included in the message that is sent.

Developer reference#

HookTypeParametersPurpose
rpress_get_whatsappfilter$options (array from the rp_whatsapp option)Adjust the saved settings before use.
wp_ajax_rpress_whatsapp_message and wp_ajax_nopriv_rpress_whatsapp_messageAJAX actionPOST name, phone, addressReturns the WhatsApp message text as JSON.

The extension also uses RestroPress's rpress_after_purchase_form action to print the button and the rpress_show_checkout_button filter to remove the normal checkout button in "Whatsapp order Only" mode.

add_filter( 'rpress_get_whatsapp', function ( $options ) {
	$options['order_text'] = 'Send my order on WhatsApp';
	return $options;
} );

Troubleshooting#

  • No WhatsApp box on checkout. Tick Enable and save. The box is printed after the purchase form, so it also depends on the checkout form rendering.
  • The button has no text. Fill in Order Text. The code does not supply a default label.
  • WhatsApp says the number is invalid. The number is placed in the link as typed. Use the international format; WhatsApp links expect digits only, so remove spaces and the plus sign if the link does not open the right chat.
  • Customers cannot pay after choosing "Whatsapp order Only". This is how that mode works: the checkout button, payment selector and payment form are hidden. Switch to "Both Checkout and Whatsapp order" to allow online ordering.
  • The popup is blocked. The WhatsApp tab opens after a server response, so strict pop-up blockers may stop it. Ask the customer to allow pop-ups for your site.
  • Message in a wrong language or with plain text issues. The message headings are fixed English text in the code.

Changelog highlights#

  • 1.1: updated tax and discount amounts; fixed the "WhatsApp order only" issue for the Square gateway.
  • 1.0.1: fixed the "Only WhatsApp order" option issue.
  • 1.0: initial release.
Was this page helpful?