Search code examples
wordpressdatewoocommercemodified-date

Woocommerce how to sort products by "last modified" date?


So here is my link:

https://snake.cl/shop/?orderby=date

This shows products by date created.

The problem I have is that I update the inventory of products and I would like them to show as if "new" or "now available".

So if I could sort by last modified date, that would work I think.

I had a look at some WP parameters for queries, and tried:

https://snake.cl/shop/?orderby=modified

but that doesn't work.

Any ideas?

Thanks!


Solution

  • OK, I figured it out for anyone else that might need this.

    This is the proper "query_var": ?orderby=modified-desc.

    https://snake.cl/shop/?orderby=modified-desc

    that sorted my products by the last modified date, i.e when I update the inventory it shows up first.