WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Sort by availability (5 posts)

  1. Tib781
    Member
    Posted 1 year ago #

    Hello,

    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.

    Thank you

    http://wordpress.org/extend/plugins/woocommerce/

    [No bumping. If it's that urgent, consider hiring someone.]

  2. IgniteWoo
    Member
    Posted 1 year ago #

    What does "Availability" mean to you in this context? Not quite clear on what data you want to sort on.

  3. Tib781
    Member
    Posted 1 year ago #

    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
    thanks
    thib

  4. IgniteWoo
    Member
    Posted 1 year ago #

    See here:

    http://docs.woothemes.com/document/custom-sorting-options-ascdesc/

    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 ).

  5. Tib781
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic