Home Forums Theme Support Dokan add custom order status

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  towhid 3 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #54658

    Bryan
    Member
    Post count: 20

    Hello, I am attempting to add a custom order status. I have created the status in woocommerce with the following code:

     
    function register_custom_order_status() {
        register_post_status( 'x-test', array(
            'label'                     => 'Test',
            'public'                    => true,
            'exclude_from_search'       => false,
            'show_in_admin_all_list'    => true,
            'show_in_admin_status_list' => true,
            'label_count'               => _n_noop( 'Test <span class="count">(%s)</span>', 'Test <span class="count">(%s)</span>' )
        ) );
    }
    add_action( 'init', 'register_custom_order_status' );
    
    // Add to list of WC Order statuses
    function add_custom_order_statuses( $order_statuses ) {
    
        $new_order_statuses = array();
    
        // add new order status after processing
        foreach ( $order_statuses as $key => $status ) {
    
            $new_order_statuses[ $key ] = $status;
    
            if ( 'wc-processing' === $key ) {
                $new_order_statuses['x-test'] = 'Test';
            }
        }
    
        return $new_order_statuses;
    }
    add_filter( 'wc_order_statuses', 'add_custom_order_statuses' );
    

    To display this status as an option for the seller I added the following code to the dokan_get_order_status_class( $status ) function located in order-functions.php :

    
     case 'x-test':
            case 'wc-x-test':
                return 'success';
                break;
    

    This allows me to select the Test status and will display “Test” as the status. the problem is that once the page is refreshed the order status changes to wc-x-test. Then when i go to the sellers order dashboard page it changes to x-test.
    Additionally, when I log in as the customer to view the order, the order disappears. the parent order displays as processing and the child order that has not been switched to “Test” appears, but the child order with the changed status does not appear.

    Please walk me through the process of adding a custom order status and having it appear on both the seller and customer order pages using the appropriate label.

    #54729

    towhid
    Participant
    Post count: 4505

    Hello Bryan,

    The requirements appear to me that you need customization of the plugin. But I am really sorry to say that we do not provide any customization services. If you need this feature very urgently please hire a developer.

    Thanks

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

The topic ‘add custom order status’ is closed to new replies.