We would like to prevent shop manager from changing order status, we found a help here in the link below Restrict user role to change only some order statuses in Woocommerce
But the issue here that it limits certain role ( shop Manager ) to some order statuses, we need to deny the shop manager from changing the order status completely not limit it to some order statuses.
Also the snippet we mentioned remove the the order statuses from the bulk action drop down & the order details here: https://prnt.sc/mpfl3b, we need to remove the statuses too from the quick action column here https://snipboard.io/B6SYHb.jpg
Simply we try to have the shop manager to when he try to change order status from bulk, order details page, or actions column to find there is no order statuses to select to change it or disable it completely.
Best Regards
2
Answers
As you can see in the example code the conditions of the statuses are determined in the if statement, because you want to apply this without a limit, it’s just a matter of removing that if statement and returning empty arrays
//Since the suggested answer apparently causes some new issues and doesn’t solve the original issue in a couple of other cases, there are options to hide elements according to user type, something like the below – which is a bit of kludge, but might serve:
First, to load an admin style sheet applying only to Shop Managers:
…and the css to hide the order-status label and menu completely, as well as related columns in shop_order sub-pages:
You’d save that in your theme css folder in a new shop_manager_styles.css.
Now, you may have some need to show the order status to shop managers without their being able to edit it. That would also be doable with CSS, if also (even more) a kludge. It may be that you have other peculiarities in your installation that will prevent the above code or a minimally customized variation of it from working, but, even if it is a little less clean than removing the option via function, this kind of thing usually will work in a pinch.
(Edited to provide option to add stylesheet on front end – in case relevant options appearing in admin bar, otherwise no need to enqueue extra non-admin script.)