Well, it may sound easy but I searched a lot but could not find the appropriate answer. I want to check if a category contains any sale products.
For example, there are 10 categories. I want to get categories that contain products with sale and exclude those categories that don’t contain any sale items.
Well, I am new to WP.
2
Answers
I searched a lot about the solution and finally I managed to write my own logic for answering this.
Steps:
Here is my sample code:
I have written a article on my blog and explain in more detail about the produces and code at https://www.kodementor.com/get-only-categories-that-contain-products-on-sale/
This code display only on sale product in your store.
Please add below code in your active theme functions.php file
May is useful for you. Thanks