Sort/Show out of stock (WooCommerce) products last

Hi,

Is there a way to show out-of-stock products last/on the last page of /shop/ and /product-category/ pages?

I do not want to just hide them.

Thanks.

If you are building your own product page (i.e. with a query loop), then you can just change order by. Set the order by to ā€œmeta_valueā€ and Meta Order Key to ā€œ_stock_statusā€. Also set the order by ascending.

Cheers
Class-Eight-Builder-

1 Like

Thanks so much - it’s working great.

Perfect, you are very welcome. =]

Cheers

Hi again, I’d like to follow up on this with a slightly more complex question.

Is there a way to put outofstock items at last like we’ve done here and still be able to sort/order by ā€˜menu order’?

Thanks.

Hi everyone,

You can use one or more Order by in a query loop to achieve the desired results. For example, in the screenshot below, you can see that I am displaying products by date, but the non-existent products are at the bottom of the product list.

I hope my answer was useful :blush: