Phone Orders For WooCommerce

Override url opened by button “View Invoice”

The Phone Orders for WooCommerce plugin provides a dedicated “View Invoice” button after an order is created (or later, when viewing an existing order). By default, the button leads to WooCommerce’s native order‑details page, which may not include a branded invoice layout provided by third‑party invoicing plugins. This guide explains how to customise the URL opened by that button, ensuring it points directly to your preferred invoice‑generating endpoint.

Before applying the code, complete the following steps:

  • Install Phone Orders for WooCommerce (Pro version recommended for access to all invoice‑related settings).
  • Enable the “View Invoice” button via the plugin’s interface (Navigate to WooCommerce → Phone Orders → Settings in your WordPress admin area)
  • Have a functioning invoice plugin installed and activated (e.g., Booster Plus for WooCommerce, PDF Invoices, or any other plugin that creates invoices and provides a dedicated URL).

The Solution: Modify the Invoice URL with a PHP Filter

The Phone Orders plugin provides a dedicated filter hook, wpo_view_invoice_url, which allows you to change the URL opened by the “View Invoice” button. This filter receives two parameters:

ParameterTypeDescription
$invoice_urlstringThe default URL (pointing to the WooCommerce order details page).
$order_idintThe ID of the order for which the invoice should be generated.

Your custom function must return the new invoice URL.

The following example for the Booster Plus plugin:

What this code does:

PartExplanation
add_filter('wpo_view_invoice_url', ... )Attaches your custom function to the wpo_view_invoice_url filter.
function ( $invoice_url, $order_id ) { ... }Your callback receives the default URL and the order ID.
add_query_arg( array(...), get_home_url() )Builds a URL with the required query parameters (order_idinvoice_type_idget_invoice).
return ...Returns the modified URL, overriding the default value.

You have two safe options for adding custom PHP code:

  • Option A (Recommended): Use the free Code Snippets plugin. This is the safest method. It allows you to add, activate, and deactivate snippets without 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.phpNever add custom code directly to a parent theme, as 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