Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1238631

    Hello Enfold support,
    Hope everyone is doing ok.

    I have some issues with the “Sort by” on the store page (WooCommerce) where I would really appreciate your help. I have tried to figure out what to do to modify it, but nothing has worked so far. I’ve checked previous treads (old and new ones), links, code shared, etc, but none of those solutions worked for me.
    In the site I’m working on, the options for “Sort by” are way too many and a lot of them unnecessary for the store (please see image – IMG-2). In your shop demo you can see that a lot of them were removed (please see image – IMG-1) .

    I would like your help with a function to add to the child theme to avoid issues when theme updates are made. In my case I would like to remove the sorting options – Custom, Date, Random, Product ID.

    Thank for looking into this.

    #1238675

    After trying a bunch of things I was able to solve the issue. Most of the links and articles online provided work for regular themes but the Sorting By options comes from the Enfold theme itself so it doesn’t work with what you find online. You can close this ticket now. Thanks.

    So the solution is to target the the enfold hook – avf_wc_product_order_dropdown_frontend.

    // Modify the default WooCommerce orderby dropdown
    //
    // Options: menu_order, popularity, rating, date, price, price-desc
    // In this example I'm removing date & product id but you can remove any of the options
    function my_woocommerce_catalog_orderby( $orderby ) {
    	unset($orderby["date"]);
    	unset($orderby["id"]);
            return $orderby;
    }
    add_filter( "avf_wc_product_order_dropdown_frontend", "my_woocommerce_catalog_orderby", 20 );

    You can remove date or more by simply adding:
    [‘default’] for’Default
    [‘menu_order’] for Custom
    [‘title’] for Name
    [‘price’] for Price
    [‘date’] for Date
    [‘popularity’] for Popularity (sales)’
    [‘rating’] for Average rating
    [‘relevance’] for Relevance
    [‘rand’] = for Random
    [‘id’] for Product ID

    Hope that helps!

    #1238694

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Store – Sort by options WooCommerce’ is closed to new replies.