Wocommerce wpse45436_posts_filter with multiple meta_key

Default Wocommerce provide basic function for search result when we want more thins to search we can customise wocommerce function by hook or add_action,

Now I want to add filter order by product name and order_type field by customising the “restrict_manage_posts” like:


By this customisation we can successfully visible and now need to set query_var to filter the result. Then need to customise another function called “wpse45436_posts_filter” by add_action Like:

Normally every one place the meta fields like above code, and i am also doing that but this get result by only one custom field in the query_var but i need all custom fields in the query_var.

After long time of research i got the idea about “$query->query_var[‘meta_query’]”  by ACF.  Then i customise my query by :

After the customisation i got the exact result, and it give filter by both meta_key, if one is set it filter by only one key and if both set it give me both filter by AND Query.

At last i am happy 🙂

Happy Coding 😀

1062 Total Views 1 Views Today