Woocommerce Categories Order

I am trying to re-order my categories from the default alphabetical order.

My admin backend my categories look like this:

Read More

enter image description here

And on the frontend they they look like this:

enter image description here

Is it possible to have them displayed in the way I have sorted them in the backend?

Related posts

5 comments

  1. And if you display your categories with the Woocommerce shortcode there is even simpler way to do it – add orderby="menu_order" to the shortcode. So for me it looks like this:

    echo do_shortcode( '[product_categories orderby="menu_order"]' )
    
  2. add this to your args list

    $args = array(
           
              'orderby'=>"menu_order",
      );
    

    Within the array used for the loop’s arguments uses native WordPress functionality to accomplish the OP’s goals… rather than installing yet another plugin where it’s not needed. “Thank you :@aronmoshe_m”

  3. While the approved answer works, there is another way using default woo functionality with no additional plugins.
    First look into:
    get_woocommerce_term_meta( $sub_category->term_id, ‘order’, true )

    Then get all your categories and sort the array using this order.

    $sortedMenu = array(); // new array
    // menu var should be get_categories or taxonomy function return
    // I also added order key/val in my category/term array item (along with other terms name, id etc)
    // Then I sorted them like bellow
    foreach( $menu as $key => $item ) $sortedMenu[$key] = $item['order'];
    array_multisort( $sortedMenu, SORT_ASC, $menu );
    
  4. I do believe you might need an additional plugin to further customize sorting options for categories.

    Try looking up Woocommerce Product Archive Customizer or similiar plugins if you do not have any similar functionality in the theme you’re using.

Comments are closed.