• Resolved myjosephines

    (@myjosephines)


    EDIT: Funny how things work… After trying to figure this out for a couple of hours – once i submit here i see what was wrong – i had a separate function hiding my custom status *facepalm*

    ————–

    I’m trying to add new order statuses, it worked fine on other websites so I’m so confused as to why it doesn’t work on this one.

    The status shows up everywhere, except that the order with the custom status will not show on /account/orders overview page.

    If I try to dump or echo the statuses of the user’s orders like so, then they will show:

    function testing() {
    	$orders = wc_get_orders( array(
    	    'customer_id' => '1',
    	) );	
    	foreach ( $orders as $order ) {
    		echo $order->get_status();
    	}
    }
    add_filter('woocommerce_before_account_orders', 'testing');

    But if I try to echo them from source-page (orders.php, i know i shall not edit that page i just did on dev-env as last resort to try and see whats wrong) they will not show (only the other statuses show):
    https://github.com/woocommerce/woocommerce/blob/master/templates/myaccount/orders.php

    What could be causing the orders with custom statuses not to show up on that page in this case? Im so confused.

    Here is the code in functions.php

    	
    function register_extra_order_statuses() {
      register_post_status( 'wc-prepaid', array(
    	'label'                     => _x( 'Prepaid', 'woocommerce' ),
    	'public'                    => true,
    	'exclude_from_search'       => false,
    	'show_in_admin_all_list'    => true,
    	'show_in_admin_status_list' => true,
    	'label_count'               => _n_noop( 'F?rbetalda <span class="count">(%s)</span>', 'F?rbetalda <span class="count">(%s)</span>' )
     ) );
    add_action( 'init', 'register_extra_order_statuses');
    
    function show_extra_order_statuses( $order_statuses ) {
    			$order_statuses['wc-prepaid'] = _x( 'Prepaid', 'woocommerce' );
    			return $order_statuses;
    		}
    		add_filter( 'wc_order_statuses', 'show_extra_order_statuses', 10, 1 );
    • This topic was modified 4 years, 7 months ago by myjosephines.
    • This topic was modified 4 years, 7 months ago by myjosephines.
  • The topic ‘Orders with custom status won’t show at orders.php’ is closed to new replies.