WooCommerce: Display “Already In Cart – Add Again?”

Need to make sure customers are not adding the same item to their cart again? Let them know the item is already added to their cart.

woocommerce add to cart button

Once you add the code snippet below, you can check to see if the item is already in the cart and add a warning message on the add to cart button.

woocommerce already in card - add again
https://gist.github.com/DeveloperWil/20f16e4e6af000b2b98258db98b33cd1

Where To Put The Code Snippet?

This code snippet should go in your active theme’s functions.php file.

Add it to the bottom of the file, before any closing ?> characters.

It’s always a good idea to take a backup of your functions.php file in case anything goes wrong – you can just copy the old code back in again.

Was this article helpful?
YesNo