I’m trying to create an archive page for "on Sale" products on my WooCommerce site, I mean an archive page, with widgets, category and attribute filters, I know I can just display "on Sale" products with a shortcode or a Gutenberg Block.
I can’t seem to find a way to do that.
After some search, I found OnSale Page for WooCommerce plugin. It works to create the archive page, but then all the filters by attribute or category keep redirecting me to the shop page, I tried to contact support, but the developers don’t seem to work on it anymore.
Has anyone faced something like this?
2
Answers
Expanding the answer from @loictheaztec, the best solution is to have an extra option in the sorting options
I've added a bit of extra code to make it work with the "Product attribute filter" and "Product Categories List" widgets, both will display only options with sale products available and avoid getting empty lists
Also, to make the categories links in widget gets the orderby parameter, I've used som Javascript
What you can do instead is to filter products from sorting options:
The following code will enable that, allowing to use with it all other filters, from widgets:
Code goes in functions.php file of your child theme (or in a plugin). Tested and works.