It may not be apparent, but doing an SQL query where you join “John” to “Doe” is not performant and cannot scale.
In 3.0 we added a new search index which actually saves the string “John Doe” to a new field which is then searchable without so much performance impact. The downside is this cannot be applied retrospectively to past orders. So when doing these types of search, only new and updated orders will be shown.
Hi Mike,
Thanks for explaining.
Apologies if I misunderstood your response, but is there no way to search for all of John Doe’s past orders (including both pre- and post- WooCommerce 3.0) through WooCommerce >> Orders?
Or, is there a way to cause WooCommerce to reindex all past orders for the new search index so that we can then find by search all of say John Doe’s past orders?
The reason is that our business runs on repeat sales, maybe like some other WooCommerce sites, so we greatly value being able to search by customer name and find all orders.
Again, sorry if I misunderstood your reply.
Scott
You can search those past orders with surname only, but the first last combination won’t work with old orders which have not been indexed.
Mike,
Is the searchable full name like “John Doe” that you referred to in WooCommerce 3.0 now placed in the “display_name” column in “wp_users”?
And is that column built from the wp_postmeta table of the columns _billing_first_name + “ “ + _billing_last_name?
This can help us write maybe a SQL script that retroactively scans past orders and updates their display_name field.
Maybe that will allow us to scan by name like “John Doe” for all past orders, both pre- and post- WooCommerce 3.0
-
This reply was modified 5 years, 11 months ago by
ScottCodes.
-
This reply was modified 5 years, 11 months ago by
ScottCodes.
I had the exact same issue with a number of client sites, and didn’t fully understand what was happening until I found this thread. As we had tens of thousands of orders to process, I built a plugin to do just that:
https://wordpress.org/plugins/order-search-repair-for-woocommerce/
Order Search Repair will scan all older orders that do not have a searchable index and either update them live or output the SQL queries so you can update the database directly yourself.
The smallest site I used it on only had about 400 orders and it took a few seconds. The largest site had over 50,000 orders and it took about 25-30 minutes (not exactly sure how long, as I went and had lunch while it was running). In total, I used the plugin to process 89,743 orders over 5 sites, and now the searching for all orders works like a charm.
Thanks for the plugin.
I used it to process all my orders however the woocommerce order history in the Customer Data tab still reads January 1, 1970 12:00 am for all orders
Are there any ideas on how to resolve this?
So far the only solution I have found has been to downgrade to woocommerce 2.6.14 however this solution is no longer compatible with the other woocommerce plugins I’m running.
-
This reply was modified 5 years, 10 months ago by
JulieMarie.
Some more information I thought might be pertinent…Searching by order and/or subscription still yields no results. I’ve tried searching by first name, last name, order number and subscription number…each time I get nothing. Any more information I can requested in resolving this issue will be provided.