-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Description
I believe I found a bug, please correct me if I am wrong.
In class-wc-query.php, product_query(),
$this->meta_query = $meta_query is stored PRIOR to
do_action( 'woocommerce_product_query', $q, $this );
In my case, I am getting ready to use that action to modify the meta_query in order to filter the products by an additional visibility flag used by my plugin.
However, since $this->meta_query is stored prior to the do_action, it is going to be out of sync with any modification performed in the action hook. Technically, I could modify $this->meta_query in my action hook, but that seems like a kludge since it requires I have knowledge of the internal coding of product_query(). Instead I think the line
$this->meta_query = $meta_query
should come after the do_action call. Make sense?
The $this->meta_query appears to be used in get_product_in_view() which means its view will not match the view modified by the action hook.