title: Apply Coupon to the same product ID in 2 different ways
body: <p>I installed a WooCommerce Smart Bundle plugin in my WooCommerce admin that enables me add a group of products under one product name as a bundle. My Add to Cart button is programmed in such a way that when I click on it, it adds the individual bundle products and their discount prices to the shopping cart.</p>
  <p>The main problem I have is, <strong>how can I apply a coupon to the same product that appears twice in my shopping cart in two different ways depending on if the cart has some specific custom meta data?</strong></p>
  <p>Case in point, I currently have a scenario where a bundle product (made up of two products) when added, puts two product items into the cart. But then, the user can decide to separately add a third product (which is one of the bundle product items) to the cart that gives you 3 items in total, with 2 of the products being the exact same but with different prices</p>
  <p>This is what I have so far (this logic, removes all discounts from applying to bundle products, but at the same time prevents individual products who have no meta data to not have discounts applied, <strong>which I am trying to prevent</strong>):</p>
  <pre><code>function exclude_bundle_products( $valid, $product, $coupon, $values ) {
      foreach ( WC()-&gt;cart-&gt;get_cart() as $cart_item ) {
          if ( $product-&gt;get_id() === $cart_item['data']-&gt;get_id() ) {
              if ( isset( $cart_item['custom_data']['new_price'] ) &amp;&amp; ! empty( $cart_item['custom_data']['new_price'] )  ) {
                  $valid = false;
              }
          }
      }
      return $valid;
  }
  add_filter( 'woocommerce_coupon_is_valid_for_product', 'exclude_bundle_products', 9999, 4 );
  </code></pre>