Merge pull request #24178 from james-allan/deprecate_before_quantity_zero_action

Deprecate the `woocommerce_before_cart_item_quantity_zero` action
This commit is contained in:
Gerhard Potgieter 2019-07-22 14:38:40 +02:00 committed by GitHub
commit ba517650a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -1172,6 +1172,7 @@ class WC_Cart extends WC_Legacy_Cart {
*/ */
public function set_quantity( $cart_item_key, $quantity = 1, $refresh_totals = true ) { public function set_quantity( $cart_item_key, $quantity = 1, $refresh_totals = true ) {
if ( 0 === $quantity || $quantity < 0 ) { if ( 0 === $quantity || $quantity < 0 ) {
wc_do_deprecated_action( 'woocommerce_before_cart_item_quantity_zero', array( $cart_item_key, $this ), '3.7.0', 'woocommerce_remove_cart_item' );
// If we're setting qty to 0 we're removing the item from the cart. // If we're setting qty to 0 we're removing the item from the cart.
return $this->remove_cart_item( $cart_item_key ); return $this->remove_cart_item( $cart_item_key );
} }