Basel Sidebar Woo Categories – Orderby categories by ID
-
Hi Elise,
Please send me a piece of code for CSS or for snippet, to change orderby of Woo categories by ID, or how they are sorted in the Categories table in woocommerce.
What happens is, in the Basel sidebar (class=”widget-area basel-sidebar-content”) in shop https://www.independent.wine/wine-shop/, categories are shown in the alphabetical order. So I have (1) By country (2) Collections (3) Red wine, etc….(7) White wine. I want to prioritise styles of wine: (1) Red wine (2) White wine…etc.
Location:
class=”widget-area basel-sidebar-content”
id=”woocommerce_product_categories-2″
class=”product-categories”
Thank you!
Hello,
Unfortunately, this modification is not implemented by custom CSS, such requires the customization which is not covered by our support.
Best Regards
Elise,
hmmm, I had a conversation with WooCommerce, they too say they cannot do anything because this widget is provided by the theme. Can you give me any way to rearrange categories please?
Hello,
The Product category is the default Woocommmerce widget and our theme does not influence its functionality.
Best Regards
Elise, hi,
it’s actually not a big change, I think the theme can overwrite Woo’s hooks. We are trying to
change the sorting inside the class=”sidebar-widget woocommerce widget_product_categories”, to sort by ID.
I’ve found this code on Sorceforge, but I think it has to be hammered a little to be compatible with Basel. Can you please have a look – if you can make this work this would be really helpful. Thank you in advance!
add_filter( ‘woocommerce_product_subcategories-args’, ‘custom_woocommerce_get_subcategories_ordering_args’ );
function custom_woocommerce_get_subcategories_ordering_args( $args ) {
$args[‘order’] = ‘asc’;
$args[‘orderby’] = ‘ID’;
return $args;
}
Hello,
Pleaase add the code to the fundtions.php of the child theme:
add_filter(
'woocommerce_product_categories_widget_args',
function( $args ) {
$args['orderby'] = 'ID';
$args['order'] = 'asc';
return $args;
}
);
Best Regards
Elise, I tested it just now – worked like a charm. Thank you so much!
You are welcome! If you have any questions please feel free to contact us.
Best Regards
The topic ‘Basel Sidebar Woo Categories – Orderby categories by ID’ is closed to new replies.