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.9.8.1

apply_filters('woocommerce_add_to_cart_sold_individually_found_in_cart') is found 1 times:

  • /includes/class-wc-cart.php line 1171
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    // 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() );
     
            /**