[woocommerce_cart_has_enough_stock_for_product] Invert the logic, change hook name
This commit is contained in:
parent
45c387e39c
commit
963bbcfca3
|
@ -786,7 +786,7 @@ class WC_Cart extends WC_Legacy_Cart {
|
|||
$held_stock = wc_get_held_stock_quantity( $product, $current_session_order_id );
|
||||
$required_stock = $product_qty_in_cart[ $product->get_stock_managed_by_id() ];
|
||||
|
||||
if ( ! apply_filters( 'woocommerce_cart_has_enough_stock_for_product', $product->get_stock_quantity() >= ( $held_stock + $required_stock ), $product, $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;
|
||||
|
|
Loading…
Reference in New Issue