WordPress filter hook

shop_order_search_fields

Fired by 2 WordPress plugins, running on 8,000+ sites between them.

“Filter shop order meta fields to search for WooCommerce”

How to use shop_order_search_fields

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'shop_order_search_fields', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Argument names come from ElasticPress's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

2 plugins that fire shop_order_search_fields

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. ElasticPress icon ElasticPress8,000+ installs apply_filters( 'shop_order_search_fields', array( '_order_key', '_billing_company', '_billing_address_1', '_billing_address_2', '_billing_city', '_billing_postcode', '_billing_country', '_billing_state', '_billing_email', '_billing_phone', '_shipping_address_1', '_shipping_address_2', '_shipping_city', '_shipping_postcode', '_shipping_country', '_shipping_state', '_billing_last_name', '_billing_first_name', '_shipping_first_name', '_shi... ) includes/classes/Feature/WooCommerce/Orders.php:416
  2. ElasticProbe icon ElasticProbeFewer than 10 installs apply_filters( 'shop_order_search_fields', array( '_order_key', '_billing_company', '_billing_address_1', '_billing_address_2', '_billing_city', '_billing_postcode', '_billing_country', '_billing_state', '_billing_email', '_billing_phone', '_shipping_address_1', '_shipping_address_2', '_shipping_city', '_shipping_postcode', '_shipping_country', '_shipping_state', '_billing_last_name', '_billing_first_name', '_shipping_first_name', '_shi... ) includes/classes/Feature/WooCommerce/Orders.php:416

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.