Hi @frenchomatic,
The code snippet you shared should indeed allow you to search by _order_total
, _user_id
, and _order_number
. However, it seems like there might be an issue with your implementation.
Please ensure that the additional fields you’re trying to search are stored as post meta in the wp_postmeta
table in your WordPress database. The woocommerce_shop_order_search_fields
filter only works with post metadata.
Also, remember that the search feature in WooCommerce uses a LIKE SQL command, so it will return any order where the meta value contains the search term. You’ll need to enter the exact value if you’re searching for a specific order total, user ID, or order number.
For reference, these particular forums are meant to provide general support for the core functionality of WooCommerce itself. For development and custom coding questions, it’s best to ask for insight related to those on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:
I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.