Home Forums Basel support forum Basel Sidebar Woo Categories – Orderby categories by ID

Basel Sidebar Woo Categories – Orderby categories by ID

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #196346

    oleg_dmitriev
    Participant

    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!

    #196499

    Hello,

    Unfortunately, this modification is not implemented by custom CSS, such requires the customization which is not covered by our support.

    Best Regards

    #196751

    oleg_dmitriev
    Participant

    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?

    #196799

    Hello,

    The Product category is the default Woocommmerce widget and our theme does not influence its functionality.

    Best Regards

    #198023

    oleg_dmitriev
    Participant

    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;
    }

    #198216

    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

    #198461

    oleg_dmitriev
    Participant

    Elise, I tested it just now – worked like a charm. Thank you so much!

    #198521

    You are welcome! If you have any questions please feel free to contact us.

    Best Regards

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Basel Sidebar Woo Categories – Orderby categories by ID’ is closed to new replies.