woocommerce_shop_order_search_fields

Using this filter, we can edit the search criteria in woocommerce order.

Usually search done based on following fields:

Array

(

[0] => _billing_address_index

[1] => _shipping_address_index

[2] => _billing_last_name

[3] => _billing_email

)

we can search woocommerce order based on above fields.

Here we can search by all fields(incuding email id and phone number ) provided in shipping address and billing address.

To include search based on sku , product id  ,etc we can use this filter.

Sample code:

add_filter( ‘woocommerce_shop_order_search_fields’, ‘search_all’);

function search_all($search_fields ) {

$search_fields[] = ‘_sku’;

$search_fields[] = ‘_product_id’;

 

return $search_fields;

}