Hide Certain Statuses in Dashboard Orders List

This snippet allows you to choose exactly which order statuses you want displayed to your vendors in the vendor-orders page. On my site, I hate hate hate “Pending Payment” orders, which for me only happen when someone abandons their cart after clicking the payment window. Also, we learned that there were issues for customers when paying through paypal inside the Facebook app browser, so there might be 2 or 3 Pending Payment orders before it was successful.

WCMp by default includes these in the orders list in both the dropdown filter as well as the list itself. This code removes them from the list table only, and must be used in conjunction with other means to change the filter dropdowns to match, if desired.

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_datatable_get_vendor_all_orders', 'order_status',10,3);
function order_status($args, $requestData, $post_data){
  $get_value_status = array();
  foreach ($args as $key => $value) {
      $order = wc_get_order($value);
      $details = $order->get_status();

      // Choose the order statuses you wish to display
      if($details == 'processing' || $details == 'completed' || $details == 'on-hold' || $details == 'refunded'){
          $get_value_status[] = $value;
      }
  }
  return $get_value_status;
}

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 *