Config search order option on header search

This topic has 2 replies, 2 voices, and was last updated 11 hours, 34 minutes ago ago by Jack Richardson

  • Avatar: javi_web
    javi_web
    Participant
    July 28, 2026 at 16:08

    Hello,
    How can I modify or customize how to order searched products result.
    I have tried: Appearance > Config > Woocommerce > Shop > Default Products order > Default ( Custom order + name)

    I have changed a product order (BÜTZMANN Q-18) to “1” I searched “Bützmann” again but it doesn’t appears the first one.

    Could you help me?

    Thank you.
    Regards,
    Javi.

    Content is visible for topic creator and
    support staff only.
    Files is visible for topic creator and
    support staff only.
    1 Answer
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 29, 2026 at 07:00

    Hello @javi_web,

    There is no such option available by default. However, if you wish to change it to make it custom sorted, you can use the following code in your child-theme/functions.php. Please choose one of the following choices below.

    1. To sort product results by price (cheapest first)

    add_filter('etheme_ajax_search_products_query', function ($args){
        $args['meta_key'] = '_price';
        $args['orderby'] = 'meta_value_num';
        $args['order'] = 'ASC';
        return $args;
    });

    2. To sort product results by popularity (best sellers first)

    add_filter( 'etheme_ajax_search_products_query', function ( $args ) {
    	$args['meta_key'] = 'total_sales';
    	$args['orderby']  = 'meta_value_num';
    	$args['order']    = 'DESC';
    	return $args;
    } );

    3. To sort by the “Menu order” value set on each product in WooCommerce -> Products

    add_filter( 'etheme_ajax_search_products_query', function ( $args ) {
    	$args['orderby'] = array(
    		'menu_order' => 'ASC',
    		'date'       => 'DESC',
    	);
    	return $args;
    } );

    Please let us know if any of these solutions are suitable for you. If you would like our assistance with implementing such snippets, we are available to help. However, we have not implemented it yet as we would like to confirm if this method is appropriate for your needs.

    Best Regards,
    Jack Richardson
    The 8Theme’s Team

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.