I try to put a "sort by" products available in my shop but it does not work.
Is that possible?
If so how?
I can bring up a "sort by availability" in the list but no more.
What does "Availability" mean to you in this context? Not quite clear on what data you want to sort on.
I have some product on stock and some another not in stock in each moment.
So I mean with"sort by availability" that my customer can choose to see only the products/item in stock in the moment that he look my shop.
The "sort by availability" is in the list of all the sorts , but he don't do the sort, I mean that all the items showing up not only who's in stock like I want to see.
Hope you understand and can help me
What you want to do is use that code and add something like this to "case" clauses in the custom_woocommerce_get_catalog_ordering_args function:
case 'availability_asc' : $args['orderby'] = 'meta_value_num'; $args['order'] = 'asc'; $args['meta_key'] = '_stock'; break;
And something like this to the custom_woocommerce_catalog_orderby function:
$sortby['availability_asc'] = 'By availability';
Or maybe change "asc" to "desc" in all instances. "asc" means ascending ( low to high ) , "desc" means decending ( high to low ).
I already try this solution but it doesn't work.
The "sort by availability" is in the list of all the sorts , but he don't do the sort.
This topic has been closed to new replies.