Many WooCommerce users use search sorting that allows users to sort by popularity or price. Unfortunately, while Relevanssi works fine with WooCommerce, those sorts do not work. Relevanssi doesn’t know about price or popularity, and the sorting assumes there’s a default WP search underneath. Relevanssi doesn’t do meta field sorting……as easily as the default WP search does. This function handles price, popularity and rating sorting: add_filter( ‘relevanssi_orderby’, ‘woocommerce_relevanssi_orderby’ ); function woocommerce_relevanssi_orderby( $orderby ) { if ( in_array( $orderby, array( ‘price’, ‘price-desc’ ), true ) ) { global $wp_query; $orderby = ‘meta_value_num’; $wp_query->query_vars[‘meta_key’] = ‘_price’; } if ( ‘price’ ===……$orderby ) { global $rlv_wc_order; $rlv_wc_order = ‘asc’; } if ( ‘date ID’ === $orderby ) { $orderby = ‘post_date’; } if ( ‘popularity’ === $orderby ) { global $wp_query, $rlv_wc_order; $orderby = ‘meta_value_num’; $rlv_wc_order = ‘desc’; $wp_query->query_vars[‘meta_key’] = ‘total_sales’; } return $orderby; } add_filter( ‘relevanssi_order’, ‘woocommerce_relevanssi_order’ ); function woocommerce_relevanssi_order(…