WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
фильтр не описан

woocommerce_add_to_cart_validation хук-фильтр . WC 2.4.6

Handle adding simple products to the cart.

Использование

add_filter( 'woocommerce_add_to_cart_validation', 'filter_function_name_9277', 10, 3 );
function filter_function_name_9277( $product_id, $product_id, $quantity ){
	// filter...

	return $product_id;
}
$product_id(число)
Product ID to add to the cart.
$product_id
-
$quantity
-

Список изменений

С версии 2.4.6 Введена.
С версии 2.4.6 Split from add_to_cart_action.

Где вызывается хук

WC_Form_Handler::add_to_cart_handler_simple()
woocommerce_add_to_cart_validation
WC_Cart_Session::populate_cart_from_order()
woocommerce_add_to_cart_validation
WC_AJAX::add_to_cart()
woocommerce_add_to_cart_validation
WC_Form_Handler::add_to_cart_handler_grouped()
woocommerce_add_to_cart_validation
WC_Form_Handler::add_to_cart_handler_variable()
woocommerce_add_to_cart_validation
woocommerce/includes/class-wc-form-handler.php 776
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
woocommerce/includes/class-wc-cart-session.php 364
if ( ! apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variations, $cart_item_data ) ) {
woocommerce/includes/class-wc-ajax.php 407
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
woocommerce/includes/class-wc-form-handler.php 807
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $item, $quantity );
woocommerce/includes/class-wc-form-handler.php 940
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variations );

Где используется хук (в ядре WC)

includes/wc-cart-functions.php 27
add_filter( 'woocommerce_add_to_cart_validation', 'wc_protected_product_add_to_cart', 10, 2 );