wc_get_orders() unexpected behavior with legacy orders, field_query and meta_query ignored #46076
Open
3 of 5 tasks
Labels
focus: data-store
Issues related to custom tables.
focus: order
Issues related to orders.
priority: high
The issue/PR is high priority—it affects lots of customers substantially, but not critically.
team: Proton
type: bug
The issue is a confirmed bug.
type: community contribution
Prerequisites
Describe the bug
Using the wc_get_orders() function to retrieve orders when the "legacy" option is selected lead to potential unexpected behavior, since the *_query arguments are simply ignored/missing in the final SQL.
At least update the documentation as it's misleading
wc_get_orders and WC_Order_Query provide a standard way of retrieving orders that is safe to use and will not break due to database changes in future WooCommerce versions.
Expected behavior
Working the same way it works when using HPOS
Actual behavior
the *_query (at least meta and field) are not used and all the orders are returned.
Steps to reproduce
WordPress Environment
Wordpress 6.4.3
WooCommerce 8.7.0
Isolating the problem
The text was updated successfully, but these errors were encountered: