I searched a lot but didn’t find any solution that work for me.
I am developing a plugin for wordpress that will work only with woocommerce. So i want that when my order status is in pending state i want to hide complete action shortcut on orders listing page.
In the above picture i want to hide middle button when my order is in pending state. I want to do it in plugin.
Any suggestion.
Thanks in advance.
Yes this can be done using ‘woocommerce_admin_order_actions’ filter and adding a function to a filter.
Code to be added in you plugin:
add_filter('woocommerce_admin_order_actions','wdm_verify_product_limitation',5,2);
function wdm_verify_product_limitation( $actions, $the_order ){
if ( $the_order->has_status( array( 'pending','on-hold') ) ) {
unset($actions['complete']);
}
return $actions;
}
Here i am checking if the order is in ‘pending’ or ‘on-hold’ state then don’t show the Complete button for that order.(in your case remove ‘on-hold’ from the code )
Have tested the same. Do let me know if this works for you