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

Force quantity to 1 if sold individually and check for existing item in cart.

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

add_filter( 'woocommerce_add_to_cart_sold_individually_found_in_cart', 'wp_kama_woocommerce_add_to_cart_sold_individually_found_in_filter', 10, 5 );

/**
 * Function for `woocommerce_add_to_cart_sold_individually_found_in_cart` filter-hook.
 * 
 * @param  $condition      
 * @param  $product_id     
 * @param  $variation_id   
 * @param  $cart_item_data 
 * @param  $cart_id        
 *
 * @return 
 */
function wp_kama_woocommerce_add_to_cart_sold_individually_found_in_filter( $condition, $product_id, $variation_id, $cart_item_data, $cart_id ){

	// filter...
	return $condition;
}
$condition
-
$product_id
-
$variation_id
-
$cart_item_data
-
$cart_id
-

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

WC_Cart::add_to_cart()
woocommerce_add_to_cart_sold_individually_found_in_cart
woocommerce/includes/class-wc-cart.php 1149
$found_in_cart = apply_filters( 'woocommerce_add_to_cart_sold_individually_found_in_cart', $cart_item_key && $this->cart_contents[ $cart_item_key ]['quantity'] > 0, $product_id, $variation_id, $cart_item_data, $cart_id );

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

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