Answer the question
In order to leave comments, you need to log in
How to override product sorting?
Each category of the store has a meta field, where product ids are indicated separated by commas. In which file and how to override the output of category products in the order specified in the category metafield?
Answer the question
In order to leave comments, you need to log in
I don’t think there is a ready-made version, you can make a plugin for these tasks
In a vein like yours, you need to catch the moment when the user is in the category.
Can be done with a hook
add_action( 'pre_get_posts', 'filters_modify_main_query' );
function filters_modify_main_query( $query ) {
if ( strpos( '_' . $_SERVER['REQUEST_URI'], '/product-category/' ) > 0 && $query->is_main_query() ) {
//change query
}
return $query;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question