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

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

Hook: woocommerce_add_to_cart_validation (legacy).

Allow 3rd parties to validate if an item can be added to the cart. This is a legacy hook from Woo core. This filter will be deprecated because it encourages usage of wc_add_notice. For the API we need to capture notices and convert to exceptions instead.

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

add_filter( 'woocommerce_add_to_cart_validation', 'filter_function_name_3083', 10, 5 );
function filter_function_name_3083( $true, $product_id, $request_quantity, $variation_id, $request_variation ){
	// filter...

	return $true;
}
$true
-
$product_id
-
$request_quantity
-
$variation_id
-
$request_variation
-

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

CartController::validate_add_to_cart()
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_simple()
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/packages/woocommerce-blocks/src/StoreApi/Utilities/CartController.php 188-195
$passed_validation = apply_filters(
	'woocommerce_add_to_cart_validation',
	true,
	$this->get_product_id( $product ),
	$request['quantity'],
	$this->get_variation_id( $product ),
	$request['variation']
);
woocommerce/includes/class-wc-cart-session.php 378
if ( ! apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variations, $cart_item_data ) ) {
woocommerce/includes/class-wc-ajax.php 410
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
woocommerce/includes/class-wc-form-handler.php 820
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
woocommerce/includes/class-wc-form-handler.php 852
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $item, $quantity );
woocommerce/includes/class-wc-form-handler.php 902
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variations );

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

woocommerce/packages/woocommerce-blocks/src/StoreApi/Utilities/CartController.php 29
add_filter( 'woocommerce_add_to_cart_validation', 'wc_protected_product_add_to_cart', 10, 2 );