Support » Plugin: WooCommerce » Removing Sort by on WooCommerce Shop Page

  • Resolved sdschub

    (@sdschub)


    Hi there

    I am trying to remove the ‘Sort by’ dropdown on a Woocommerce Shop page

    I am using this code in my functions.php

    remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );

    However, it doesn’t seem to work for me? I have the dropdown hidden in CSS currently but I’d prefer if it wasn’t there at all rather than it being there but hidden.

    Thanks.

    • This topic was modified 2 years, 2 months ago by sdschub.
    • This topic was modified 2 years, 2 months ago by James Huff.
Viewing 9 replies - 16 through 24 (of 24 total)
  • Thanks, @yitwail, that one worked for me!

    @rynald0s

    thanks for the code, it works!
    but it doesn’t work for mobile?

    refinings from @yitwail for to remove from after loop as well:

    add_action( 'before_woocommerce_init', function() {
    remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); // when using storefront replace 30 with 10
    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 30 ); // when using storefront replace 30 with 10
    } );

    Hi,
    that simple CSS code

    .woocommerce-ordering {
      display: none;
    }

    shown previously hides the sorting dropdown menu for me but unfortunately not sorting results display: ‘Showing all x results‘.

    Additional CSS for hiding sorting results display, too?

    • This reply was modified 1 year, 5 months ago by ajaaskel.

    I cant´t get this on Storefront+Boutique. I want to get rid of the “Sort by” block at the bottom of the page, and I tried with many different suggestions, with no luck.

    By the way, I want to remove the pagination block, at the top! hehehe

    Any ideas on how to make it work by a code snippet??
    Thanks in advance!

    • This reply was modified 1 year, 1 month ago by speedbit.

    Thanks! This worked for me.

    Kriesi Enfold Theme

    Add the following to your enfold-child functions.php file

    add_action( 'before_woocommerce_init', function() {
    remove_action( 'woocommerce_before_shop_loop', 'avia_woocommerce_frontend_search_params', 20 );
    } );
    

    Yitwail’s suggestion:

    add_action( 'before_woocommerce_init', function() {
    remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
    } );

    worked for me in Divi theme.

    Thanks.

    • This reply was modified 10 months, 3 weeks ago by nebuar.
    • This reply was modified 10 months, 3 weeks ago by nebuar.

    If you’re using storefront you’ll need to adjust the actions that it adds after the theme is setup. Use the below to remove the entire section.

    See storefront/inc/woocommerce/storefront-woocommerce-template-hooks.php for more info.

    add_action('after_setup_theme', 'remove_actions', 10);
    function remove_actions(){
        remove_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper', 9 );
        remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
        remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
        remove_action( 'woocommerce_before_shop_loop', 'storefront_woocommerce_pagination', 30 );
        remove_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper_close', 31 );
    }
Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘Removing Sort by on WooCommerce Shop Page’ is closed to new replies.