woocommerce_cart_item_required_stock_is_not_enough

woocommerce_cart_item_required_stock_is_not_enough

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

apply_filters('woocommerce_cart_item_required_stock_is_not_enough') is found 1 times:

  • /includes/class-wc-cart.php line 792
    			 * @param bool       $has_stock If have enough stock.
    			 * @param WC_Product $product   Product instance.
    			 * @param array      $values    Cart item values.
    			 */
    			if ( apply_filters( 'woocommerce_cart_item_required_stock_is_not_enough', $product->get_stock_quantity() < ( $held_stock + $required_stock ), $product, $values ) ) {
    				/* translators: 1: product name 2: quantity in stock */
    				$error->add( 'out-of-stock', sprintf( __( 'Sorry, we do not have enough "%1$s" in stock to fulfill your order (%2$s available). We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name(), wc_format_stock_quantity_for_display( $product->get_stock_quantity() - $held_stock, $product ) ) );
    				return $error;
    			}
    		}