Home › Forums › General Help › Grid display order by stock?
Is there any way to order the grid on the product page by inventory, so products with current stock will show first? thanks.
Sadly, this is not there by default.
We’re using the standard WordPress “orderby” functionality which only takes: -date -title -post ID
This is a part of the WordPress ‘query posts’ function: http://codex.wordpress.org/Function_Reference/query_posts
To do what you want to do, you might have to change this to use your own custom function.
wow, that opens up a whole new can or worms. I dont think i have the time to tackle that one. My limited knowledge on this would make it quite difficult to achieve.
have any idea how i would start working on this?
Actually, I was thinking about this and it is not so difficult.
The stock amounts are JUST another custom field attached to the products.
It should be easily possible to use an ordinary WordPress ‘query posts’ function to list products and then order them by the stock custom field.
Of course you’d need to actually write the code that does the ordering but being able to use query posts is a big + 🙂
Well maybe someone could write it as it could be very useful.
No promises on delivery date but it was interesting enough that I am working on it. 🙂
I would love you forever if you did….