woocommerce_prevent_adjust_line_item_product_stock
Prevent adjust line item product stock.
Usage
add_filter( 'woocommerce_prevent_adjust_line_item_product_stock', 'wp_kama_woocommerce_prevent_adjust_line_item_product_stock_filter', 10, 3 ); /** * Function for `woocommerce_prevent_adjust_line_item_product_stock` filter-hook. * * @param bool $prevent If should prevent. * @param WC_Order_Item $item Item object. * @param int $item_quantity Optional quantity to check against. * * @return bool */ function wp_kama_woocommerce_prevent_adjust_line_item_product_stock_filter( $prevent, $item, $item_quantity ){ // filter... return $prevent; }
- $prevent(true|false)
- If should prevent.
- $item(WC_Order_Item)
- Item object.
- $item_quantity(int)
- Optional quantity to check against.
Changelog
Since 3.7.1 | Introduced. |
Where the hook is called
woocommerce_prevent_adjust_line_item_product_stock
woocommerce/includes/admin/wc-admin-functions.php 240
if ( apply_filters( 'woocommerce_prevent_adjust_line_item_product_stock', false, $item, $item_quantity ) ) {