woocommerce_pay_order_product_has_enough_stock │ filter-hook │ WC 8.1.0

Filters whether or not the product has enough stock.

Usage

add_filter( 'woocommerce_pay_order_product_has_enough_stock', 'wp_kama_woocommerce_pay_order_product_has_enough_stock_filter', 10, 3 );

/**
 * Function for `woocommerce_pay_order_product_has_enough_stock` filter-hook.
 * 
 * @param boolean                          $has_enough_stock True if has enough stock.
 * @param \WC_Product                      $product          Product.
 * @param \WC_Order|\WC_Order_Refund|false $order            Order.
 *
 * @return boolean
 */
function wp_kama_woocommerce_pay_order_product_has_enough_stock_filter( $has_enough_stock, $product, $order ){
	// filter...
	return $has_enough_stock;
}
$has_enough_stock(true|false)
True if has enough stock.
$product(\WC_Product)
Product.
$order(\WC_Order|\WC_Order_Refund|false)
Order.

Changelog

Since 8.1.0 Introduced.

Where the hook is called

OrderController::get_failed_order_stock_error()
woocommerce_pay_order_product_has_enough_stock
WC_Shortcode_Checkout::order_pay()
woocommerce_pay_order_product_has_enough_stock
woocommerce/src/StoreApi/Utilities/OrderController.php 807
if ( ! apply_filters( 'woocommerce_pay_order_product_has_enough_stock', ( $product->get_stock_quantity() >= ( $held_stock + $required_stock ) ), $product, $order ) ) {
woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php 168
if ( ! apply_filters( 'woocommerce_pay_order_product_has_enough_stock', ( $product->get_stock_quantity() >= ( $held_stock + $required_stock ) ), $product, $order ) ) {

Where the hook is used in WooCommerce

Usage not found.