woocommerce_update_cart_validation

The WooCommerce woocommerce update cart validation hook.

Description

apply_filters( 'woocommerce_update_cart_validation', (bool) $true, (unknown) $cart_item_key, (unknown) $values, (unknown) $quantity ); 

Parameters (4)

0. $true (bool) => true
The true.
1. $cart_item_key (unknown)
The cart item key.
2. $values (unknown)
The values.
3. $quantity (unknown)
The quantity.

Usage

To run the hook, copy the example below.
  1. $true = apply_filters( 'woocommerce_update_cart_validation', $true, $cart_item_key, $values, $quantity ); 
  2.  
  3. if ( !empty( $true ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_update_cart_validation callback 
  2. function filter_woocommerce_update_cart_validation( $true, $cart_item_key, $values, $quantity ) { 
  3. // make filter magic happen here... 
  4. return $true
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_update_cart_validation', 'filter_woocommerce_update_cart_validation', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_update_cart_validation', 'filter_woocommerce_update_cart_validation', 10, 4 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/class-wc-form-handler.php  
  1. $passed_validation = apply_filters( 'woocommerce_update_cart_validation', true, $cart_item_key, $values, $quantity );