title: Set notification if is two product category in cart
body: <p>I'm trying to set notifications when I have products from these two different categories inside the card in <code>WooCommerce</code>.</p>
  
  <p>This is the code which I using:</p>
  
  <pre><code>add_action( 'woocommerce_checkout_before_customer_details', 'webroom_check_if_product_category_is_in_cart' );
  function webroom_check_if_product_category_is_in_cart() {
  
      $cat_in_cart = false;
  
      foreach ( WC()-&gt;cart-&gt;get_cart() as $cart_item_key =&gt; $cart_item ) {
  
          if ( has_term( 'cat1', 'product_cat', $cart_item['product_id'] ) &amp;&amp;
               has_term( 'cat2', 'product_cat', $cart_item['product_id'] ) ) {
              $cat_in_cart = true;
              break;
          }
      }
  
      if ( $cat_in_cart ) {
          $notice = 'Notification';
          wc_print_notice($notice, 'notice');
      }
  }
  </code></pre>
  
  <p>This code works perfectly if I only set one category, but when I set two categories, for some reason I don't have results nor errors.</p>