Color filters and de Sort function
I have a question. We have sorted all our products with our own algorithm in the sort.
But now when I go to a categorie, and choose a color in the filter color. It looks like the sort function stops working and the colors are now showed according to the algorithm.
Can you please help me how to fix this?
I checked in depth the WooCommerce code, but could not find a way to force the WooCommerce sortby drop down list with a default value. I could not even make work the standard WooCommerce default sortby value (defined in the customizer).
The default sortby is applied by WPSOLR. But it is not displayed as selected in the WooCommerce dropdown list.
In woocommerce_catalog_ordering() of file wc-template-functions.php:
$default_orderby = wc_get_loop_prop( ‘is_search’ ) ? ‘relevance’ : apply_filters( ‘woocommerce_default_catalog_orderby’, get_option( ‘woocommerce_default_catalog_orderby’, ” ) );
$orderby = isset( $_GET[‘orderby’] ) ? wc_clean( wp_unslash( $_GET[‘orderby’] ) ) : $default_orderby; // WPCS: sanitization ok, input var ok, CSRF ok.
The 2 lines above show that the default orderby is always ‘relevance’ for search, unless ‘orderby’ url query parameter is set by a previous user selection.
- This reply was modified 2 years, 4 months ago by wpsolr.
You must be logged in to reply to this topic.