Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1411239

    Hi,
    You guys are always great with answers. Do you have a Quick CSS code that would allow me to Remove all WooCommerce “Sort by” options except Price?

    thanks!!

    #1411240

    So basically, the only Sort option we need is Price. And the up and down button next to it.

    And doesn’t show any other sort options.

    Thanks!

    #1411241

    access to site included for testing, if needed

    #1411333

    Hi,

    Thank you for the inquiry,

    You can add this filter in the functions.php file to remove the other parameters in the sort dropdown.

    /* 
     * Filter to customize the options for the product sorting dropdown
     * 
     * Filter is located: config-woocommerce\config.php    function avia_woocommerce_frontend_search_params
     */
    function my_wc_product_order_dropdown_frontend( array $product_order )
    {	
         unset( $product_order['popularity'] );
         unset( $product_order['rating'] );
         unset( $product_order['relevance'] );
         unset( $product_order['id'] );
         unset( $product_order['menu_order'] );
    
         return $product_order;
    }
    add_filter( 'avf_wc_product_order_dropdown_frontend', 'my_wc_product_order_dropdown_frontend', 10, 1 );
    

    Best regards,
    Ismael

    #1411341

    I break the site when I add your code to the functions.php file. Is there a certain place to add it? Here is the html code:

    // please use pastebin

    #1411348

    Hi!

    You have to add the code in the child theme’s functions.php file and make sure to copy the code directly from the forum. If you haven’t installed a child theme yet, please check the documentation below for more info.

    // https://kriesi.at/documentation/enfold/child-theme/#how-child-themes-work

    Please make sure to create a site backup or a restore point before activating the child theme.

    Regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.