Restrict users that can update stock status
-
I am building a marketplace website. There is a certain set of products that can only be one-offs, meaning there is only ever one in stock and when it’s out of stock it’s gone. I experimented with deleting or trashing the product after a certain point in an order transaction, but there are too many things that depend on that product continuing to be “active” even if it doesn’t display to customers. There would be time for a vendor to change the stock status of a product and sell that product multiple times when there is only one available.
I was looking for a filter or action I could use to disable changes to stock status for anyone but administrators. I came across the “woocommerce_can_reduce_order_stock”, but it seems like this is only specific to after payment stock changes.
I considered disabling or removing the stock options output in the Product Data meta box, but those options are output using “woocommerce_wp_text_input” and “woocommerce_wp_select” directly in output() (WC_Meta_Box_Product_Data). They don’t use or go through any hooks.
Is there a hook or a filter I can use that is more broadly used or specific to changes to the product in the admin area?
- The topic ‘Restrict users that can update stock status’ is closed to new replies.