Remove Order Statuses From Pending Shipping Widget

This snippet can customize the Pending Shipping section on the Dashboard screen in the Vendor Dashboard. The example shown here will display orders that are not Cancelled or On Hold status… since yeah, they’re not pending shipping. Duh.

The previous post shows how to just remove this entire widget, if that’s what you might like to do instead.

As always, this is either added to your Child Theme’s functions.php file, or consider using the My Custom Functions Pro plugin to manage and organize all your snippets.

add_filter( 'wcmp_vendor_order_report_of_data', 'restrict_pending_shipping_with_status', 10, 3 );

function restrict_pending_shipping_with_status( $reports, $report_type, $args ) {
    if( $report_type == 'pending_shipping' ) {
        foreach( $reports as $report => $value) {
            $pending_order_status = $value->get_status();

            // Choose which order statuses to exclude by using the not equal signs with the status
            if( ($pending_order_status != 'cancelled') && ($pending_order_status != 'on-hold') ) {
                $pending_orders[$report] = $value;
            }
        }
        return $pending_orders;
    }
    return $reports;
}

Is this no longer relevant or not working? Please let us know in the comments!

Comments on this post

Your email address will not be published. Required fields are marked *