woocommerce_cart_item_data_to_validate
Gets a hash of important product data that when changed should cause cart items to be invalidated.
The woocommerce_cart_item_data_to_validate filter can be used to add custom properties.
Использование
add_filter( 'woocommerce_cart_item_data_to_validate', 'wp_kama_woocommerce_cart_item_data_to_validate_filter' ); /** * Function for `woocommerce_cart_item_data_to_validate` filter-hook. * * @param $product * * @return */ function wp_kama_woocommerce_cart_item_data_to_validate_filter( $product ){ // filter... return $product; }
- $product
- -
Где вызывается хук
woocommerce_cart_item_data_to_validate
woocommerce/includes/wc-cart-functions.php 561-568
apply_filters( 'woocommerce_cart_item_data_to_validate', array( 'type' => $product->get_type(), 'attributes' => 'variation' === $product->get_type() ? $product->get_variation_attributes() : '', ), $product )