Phone Orders For WooCommerce

Show customer phone

When an agent selects a customer in the Phone Orders, the Billing Details section populates their address. However, the customer’s phone number is not displayed. This creates a significant slowdown: to find a contact number, the agent must click away to the customer’s profile. Every second counts during a live call, and this extra step increases call times and leads to a poorer customer experience.


The Solution: A Simple Code Snippet

The Phone Orders for WooCommerce plugin provides two dedicated developer hooks that let you modify customer data before it is displayed: wpo_get_customer_by_array_data and wpo_after_update_customer. By attaching a custom function to these hooks, you can intercept the customer data array and append the phone number to the address.

The Complete Code Snippet

What This Code Does

  1. Checks for a phone number: The function first checks if the billing_phone field exists for the selected customer. If it does, the code proceeds.
  2. Appends the phone number: The phone number is added to the end of the existing formatted_billing_address string. The code also adds a line break (<br>) and a bold “Phone:” label for clear formatting.
  3. Returns the modified data: The updated customer data array is returned to the plugin, which then displays the enriched address in the interface.

Pro tip: To add the phone number on the same line as the address, simply remove the <br> from the code.

Choose where to add the code

You have two reliable options for adding custom PHP code:

  • Option A (Recommended): Use a code snippet plugin. The free Code Snippets plugin is the safest method. It allows you to add, activate, and deactivate code snippets without ever touching your theme files.
  • Option B: Add to your child theme’s functions.php file. If you are comfortable editing theme files, add the code to your active child theme’s functions.php file. Never add custom code directly to a parent theme, because it will be lost when the theme is updated.

Have questions? Please submit a support request. We're always happy to help!

Phone Orders
for WooCommerce
PRO

From $120
Buy
✓ 30-day money-back guarantee