woocommerce_pay_order_product_in_stock │ filter-hook │ WC 8.1.0

Filters whether or not the product is in stock for this pay for order.

Usage

add_filter( 'woocommerce_pay_order_product_in_stock', 'wp_kama_woocommerce_pay_order_product_in_stock_filter', 10, 3 );

/**
 * Function for `woocommerce_pay_order_product_in_stock` filter-hook.
 * 
 * @param boolean                          $is_in_stock True if in stock.
 * @param \WC_Product                      $product     Product.
 * @param \WC_Order|\WC_Order_Refund|false $order       Order.
 *
 * @return boolean
 */
function wp_kama_woocommerce_pay_order_product_in_stock_filter( $is_in_stock, $product, $order ){
	// filter...
	return $is_in_stock;
}
$is_in_stock(true|false)
True if in 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_in_stock
WC_Shortcode_Checkout::order_pay()
woocommerce_pay_order_product_in_stock
woocommerce/src/StoreApi/Utilities/OrderController.php 781
if ( ! apply_filters( 'woocommerce_pay_order_product_in_stock', $product->is_in_stock(), $product, $order ) ) {
woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php 154
if ( ! apply_filters( 'woocommerce_pay_order_product_in_stock', $product->is_in_stock(), $product, $order ) ) {

Where the hook is used in WooCommerce

Usage not found.