The meta_query argument (that you can use in a WP_Query) is not enabled by default when using a WC_Order_Query through wc_get_orders() WooCommerce function.
But for you can use the undocumented Custom Field Parameters (just like in a WP_Query):
meta_keymeta_valuemeta_value_nummeta_compare
So in your case you can use the following instead:
$orders = wc_get_orders( array(
'limit' => -1, // Query all orders
'orderby' => 'date',
'order' => 'DESC',
'meta_key' => 'var_rate', // The postmeta key field
'meta_compare' => 'NOT EXISTS', // The comparison argument
));
This time it works nicely (Tested on WooCommerce 3.5.8 and 3.6.2).
Related Posts:
- Woocommerce Get Orders By Meta Value
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Custom WP_Query order by post_meta and (author) user_meta
- WP_Query for WooCommerce Products
- Perform query with meta_value date
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- how to retrieve specific product attribute value in an sql query?
- WP Query – Get WooCommerce Products with variation that is in stock
- Meta Query for specific months
- How to orderby meta_value_num with dollar ($) sign
- Extending woocommerce admin product search
- merge two query arguments into one WP_Query call
- Get all products which have both product category
- Optional Meta Query
- Overwrite YoastSEO meta-tags with another page’s [closed]
- How to orderby multiple meta fields if some fields are empty
- Extend product search with meta in WooCommerce
- Meta Query relation “AND” then set array accordingly
- How to set up hierarchical relationships without using plugins / meta query
- Multiple meta_key ordering with pre_get_posts
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- Why doesn’t my WP Meta Query return any results?
- WP_Query meta compare must include ALL array values
- meta_query where the meta value is not the post title
- Query multiple post types, but different order for each
- ElasticPress is (aparently) messing with my search filters
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Meta query orderby meta_value_num sorting by role first
- Query against multiple locations within single custom post type post
- Strange results from WP_Query
- WP Query. Ordering posts by another post types meta
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Query by meta value (add a dropdown of all values)
- Meta query doesn’t remove placeholder escape before query
- Create global array to compare inside a query
- What is the best way to reset a search on a meta_key / meta_value?
- How can I modify standard search query to include also ACF custom fields values?
- Using the same WP_Query for shop and widgets in WooCommerce shop
- Filter posts/pages by user_role array
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- Use meta query only 3 or more results?
- Use value from meta key array for use in WP_Query
- How to use meta_query to retrieve posts from multiple custom post type
- How to get products with the same custom attribute like ean code
- order by numeric value for meta value
- How to query posts based on lat-lng coordinate as post meta?
- Set Alias for meta_query arguments in get_posts()
- How to query only for products with status “in stock” in WooCommerce? [closed]
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- datetime picker, timestamps and meta queries
- Compare two meta-fields in a wp_query (where meta-field-A is larger than meta-field-B)
- Meta Query querrying several post types based on ACF fields is broken after update to WP 4.1
- How to get sum of meta_values of a meta_key in wp_query according to conditions
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- how to speed up a complex wp_query?
- if/else on custom query gives 200 OK when condition not met?
- Creating arguments from loop for WP_Query meta_query
- ACF Date Based wp_query
- only delete post within query / for each statement (front end)
- Mysql query and order meta value
- meta_query BETWEEN, but the range is stored in the custom field
- Having trouble with WooCommerce Storefront child theme single.php “related posts” modification [closed]
- Order ascending is ignored in meta query?
- How to get list of posts from permalinks?
- Advanced WP_Query with meta_query, orderby?
- Redirect Search to Form When No Product Results Are Found
- Issues with search after added meta_query
- Display posts with specific value first in query
- How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?
- How to create dynamic value in WP_Query meta_query
- Woocommerce: order posts by meta key
- query post by author gender
- How do I add an item to the WP admin menu?
- Multiple meta query from array
- Unlimited Page Sitemap Link
- WP_Query with 4 post meta field arguments gives 500 internal server error
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- Post incorrectly excluded when using “category__in”?
- Display posts ONLY from the current logged in user and current week/year/month Elementor posts
- Custom meta_query order for Elementor based on post meta key [closed]
- What’s wrong with this meta query? (order by meta key, then title, doesn’t work)
- Multiple meta_query not returning rows
- What code to use in an array to call the current sub-category?
- Get unique post by meta value using wp_query
- WP_Query, ACF field and array
- Order by Date Custom Field
- WP_Query to Retrieve Posts from WooCommerce Products that are Only in Catalog
- Get posts meta_query by repater field
- Query 3 meta_key and orderby
- meta_query not working with the_content()
- Get closest event where meta_key field is an array
- Pagination in custom query in a category page
- Get a list of the last posts grouped by author and filtered by category
- How to query post ids liked by the Author
- Meta_query weird behaviour
- Modify query after meta value
- Pagination in WP query with transient API
- Main loop querying current template’s info only in custom category archive pages, not my posts
- posts_per_page showing 16 elements instead of 3