Query loop - Product archive - Show featured/On Sale products first

Hi everyone.

A client asked me to make it so that all products on sale show up first in the product category archive.
I tried sorting by sale_price, but that removes all the non-sale items.
I tried injecting a custom query through functions.php, but that either completely breaks the filters or the pagination.

Is there a simpler way? Double-query is also kind of bad, because the featured products would have pagination in the middle of the page.

1 Like

Try using _price instead of _sale_price. _sale_price only exists for products on sale, so non-sale products get excluded. _price works for all products and still respects sale prices, as far as I remember.

1 Like