woocommerce_add_to_cart_sold_individually_found_in_cart

woocommerce_add_to_cart_sold_individually_found_in_cart

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_add_to_cart_sold_individually_found_in_cart') is found 1 times:

  • /includes/class-wc-cart.php line 1156
     
    			// Force quantity to 1 if sold individually and check for existing item in cart.
    			if ( $product_data->is_sold_individually() ) {
    				$quantity      = apply_filters( 'woocommerce_add_to_cart_sold_individually_quantity', 1, $quantity, $product_id, $variation_id, $cart_item_data );
    				$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 );
    
    				if ( $found_in_cart ) {
    					/* translators: %s: product name */
    					$message = sprintf( __( 'You cannot add another "%s" to your cart.', 'woocommerce' ), $product_data->get_name() );
    
    					/**