title: WooCommerce: Check if items are already in cart
body: <p>I found this great snippet from this <a href="https://joebuckle.me/quickie/woocommerce-check-if-item-already-in-cart/" rel="noreferrer">website</a></p>
  
  <p>The following is the function to check if a specific product exists in cart: </p>
  
  <pre><code>        function woo_in_cart($product_id) {
          global $woocommerce;         
          foreach($woocommerce-&gt;cart-&gt;get_cart() as $key =&gt; $val ) {
              $_product = $val['data'];
  
              if($product_id == $_product-&gt;id ) {
                  return true;
              }
          }         
          return false;
          }
  </code></pre>
  
  <p>And this to use anywhere needed: </p>
  
  <pre><code>      if(woo_in_cart(123)) {
       // Product is already in cart
       }
  </code></pre>
  
  <p>The problem is how to use it to check multiple products like this: </p>
  
  <pre><code>      if(woo_in_cart(123,124,125,126...)) {
       // Product is already in cart
       }
  </code></pre>
  
  <p>Thanks.</p>
  
  <p><a href="https://joebuckle.me/quickie/woocommerce-check-if-item-already-in-cart/" rel="noreferrer">source</a></p>