Im trying to get all orders that have a certain value in a custom meta data.
Here is a basic query using wc_get_orders
$delivered_orders = (array) wc_get_orders( array(
'limit' => -1,
'status' => 'wc-delivered',
'type' => 'shop_order',
'date_created' => '>'. $from,
) );
Here im getting all orders that have the status wc-delivered
and that were created from a certain date, I also need to filter those which their meta data _my_meta_data
is equal to "some value"
2
Answers
You can add Custom Parameter to query variables, like this:
1. Filter the generated query.
2. Usage