<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Check product if already exist in to cart using woocommerce.]]></title>
	<link>https://bioinformaticsonline.com/blog/view/36425/check-product-if-already-exist-in-to-cart-using-woocommerce?</link>
	<atom:link href="https://bioinformaticsonline.com/blog/view/36425/check-product-if-already-exist-in-to-cart-using-woocommerce?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/blog/view/36425/check-product-if-already-exist-in-to-cart-using-woocommerce</guid>
	<pubDate>Sun, 29 Apr 2018 00:27:22 -0500</pubDate>
	<link>https://bioinformaticsonline.com/blog/view/36425/check-product-if-already-exist-in-to-cart-using-woocommerce</link>
	<title><![CDATA[Check product if already exist in to cart using woocommerce.]]></title>
	<description><![CDATA[<p>Check product if already exist in to cart using woocommerce.<br /><br />add_action( 'woocommerce_add_to_cart_validation', 'check_product_added_to_cart', 10, 3 );<br /><br />function check_product_added_to_cart( $passed, $product_id, $quantity) {<br /><br />foreach (WC()-&gt;cart-&gt;get_cart() as $cart_key =&gt; $cart_item ){<br />// if products are already in cart:<br />if( $cart_item['product_id'] == $product_id ) {<br />// Set the verification variable to "not passed" (false)<br />$passed = false;<br />// (Optionally) Displays a notice if product(s) are already in cart<br />wc_add_notice( '&lt;strong&gt;' . $btn['label'] . '&lt;/strong&gt; ' . __( 'This product is already in your cart.', 'woocommerce' ), 'error' );<br />// Stop the function returning "false", so the products will not be added again<br />return $passed;<br />}<br />}<br />return $passed;<br />}</p><p>More at https://phpajaxhtml.blogspot.in/2017/11/check-product-if-already-exist-in-to.html</p>]]></description>
	<dc:creator>Ram Yash Pal</dc:creator>
</item>

</channel>
</rss>