Changing text for product add to cart error
-
I would like to change the default text of the message: “You already have this item in your cart” which happens when you have products that are sold individually. In class-wc-cart.php there is the following function:
if ( $product_data->is_sold_individually() ) { $in_cart_quantity = $cart_item_key ? $this->cart_contents[$cart_item_key]['quantity'] : 0; // If its greater than 0, its already in the cart if ( $in_cart_quantity > 0 ) { $woocommerce->add_error( sprintf('<a href="%s">%s</a> %s', get_permalink(woocommerce_get_page_id('cart')), __( 'View Cart →', 'woocommerce' ), __( 'You already have this item in your cart.', 'woocommerce' ) ) ); return false; } }
As you can see the text is defined above. How would I change this text using the functions.php file?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Changing text for product add to cart error’ is closed to new replies.