Ecommerce Shopify WordPress Discussion

Woocommerce_shop_order_search_fields search order by meta field not working HPOS

Before switching to HPOS we had the following code in our functions.php to make it possible to search by a meta field in the woocommerce admin -> orders section. function custom_woocommerce_shop_order_search_fields( $search_fields ) { $search_fields[] = 'tracking_number'; return $search_fields; } add_filter( 'woocommerce_shop_order_search_fields', 'custom_woocommerce_shop_order_search_fields' ); The meta data inside the order is "tracking_number". After switching to HPOS this doesn't seem to work anymore. I can't seem to find what has changed and why it isn't working anymore. What is the correct way to do this with HPOS?
According to provided code, to get "order search by meta field functionality" working, when woocommerce High-Performance Order Storage (HPOS) is enabled, the filter "woocommerce_shop_order_search_fields" can be replaced by filter "woocommerce_order_table_search_query_meta_keys". The updated code is as follows: function custom_woocommerce_shop_order_search_fields( $search_fields ) { $search_fields[] = 'tracking_number'; return $search_fields; } add_filter( 'woocommerce_order_table_search_query_meta_keys', 'custom_woocommerce_shop_order_search_fields' );

January 7, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.