WC Displaying only product with given criteria or id in archive page

I’ve created a button that’s collecting product_ids to the array. Now i want to display the shop page with only products that are contained in array.

This button grabs all the product ids where custom meta key – _brand_ids wchich is array – contain specific id passed by my custom search engine.

For example let’s say that my button collected this array:

$product_ids = [“1″,”2″,”3″,”4″,”5”];

Now i want to redirect user to the shop page and filter displayed products by their IDs from $product_ids array or give loop the id and search all products where meta key _brand_ids (array) contain this id.

So how to redirect the user to the shop page and filter the product_loop?

Read more here:: WC Displaying only product with given criteria or id in archive page

Leave a Reply

Your email address will not be published. Required fields are marked *