How to query WooCommerce orders where meta data does not exist?
You can use this code to make the meta_query parameter works with WooCommerce (orders) queries: But as I’ve pointed in my comment, to query for all orders where the var_rate metadata is not empty, set the compare to !=:
Is there a way to filter subscriptions in WooCommerce?
If you wish to dynamically add a subscription to a user, and for whatever reason do not want it stored in the database, perhaps because the subscription is stored on another store, you could use this filter. $has_subscription A boolen flag (true or false) to indicate whether a given user has a subscription to a certain product.
Can a meta query be used in a WP query?
At the moment all orders are returned using those arguments. 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):
Where can I find the WooCommerce store manager guide?
If you are looking for a guide to creating and managing subscription products in a WooCommerce store, please refer to the Store Manager Guide instead. This document provides a reference for a few of the more important filter hooks triggered by the WooCommerce Subscriptions extension.
How to check if a meta field exists in WordPress?
metadata_exists () | Function | WordPress Developer Resources metadata_exists (string $meta_type, int $object_id, string $meta_key) Determines if a meta field with the given key exists for the given object ID.
How to query where meta data does not exist?
But in the question’s body, you said ” where some additional metadata is equal to not empty ” and also ” if the var_rate is empty or doesn’t exist then do not return that record “, and for that, the ‘compare’ => ‘!=’ or ‘meta_compare’ => ‘!=’ is what you would need.