Support » Plugin: WooCommerce » Change sequence in woocommerce subsubsub menu

  • Resolved stelmsk

    (@stelmsk)


    Hi! Can’t figure how to change sequence in woocommerce subsubsub menu. A used “Woocomerce Order status” plugin to create few order statuses. And now i want to swipe them in the sub menu on “orders page”. Screenshot is at the link.
    Thank you!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Hannah S. a11n

    (@fernashes)

    Automattic Happiness Engineer

    Hey there!

    The links in the screenshot are links to different order statuses – they don’t usually change order as they’re just there to help you out.

    To change the order, you’d need to get into the WooCommerce code. That’s a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the following places for more development-oriented questions:
    * WooCommerce Slack Community: https://woocommerce.com/community-slack/
    * Advanced WooCommerce group on Facebook: https://www.facebook.com/groups/advanced.woocommerce/

    I was faced with similar challenge and this was how i managed to solve it. You can put the code below in your function.php or go ahead and make it a plugin

    function rename_order_status_type($order_statuses) {
    /*the order you want the status to be in. If you want to keep the position of a certain status just leave it blank. In this case the first status will retain its position*/
    
    	$key_order = array("","wc-pending","wc-processing","wc-cancelled","wc-failed","wc-awaiting-approval","wc-transit","wc-dispatched","wc-completed");
    	return reorder_associate_arr($key_order, $order_statuses);
    }
    
    function reorder_associate_arr($key_order, $order_statuses){
        $new_arr = array();
    
        $keys = array_keys($order_statuses);
        $index = 0;
        foreach ($key_order as $key){
            if(trim($key) == "")
    	        $new_arr[$keys[$index]] = $order_statuses[$keys[$index]];
            else
    	        $new_arr[$key] = $order_statuses[$key];
    
    	    $index++;
        }
    
        return $new_arr;
    }
    
    add_filter( 'woocommerce_register_shop_order_post_statuses', 'rename_order_status_type');
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change sequence in woocommerce subsubsub menu’ is closed to new replies.