title: Add an popup/alert when add prodcut in cart with shipping class "FRESH" in Woocommerce
body: <p>I want to create an alert when I add a product with the shipping class &quot;FRESH&quot; to the shopping cart with Woocommerce.</p>
  <p>I have created this function although I know that they contain 2 Hooks because I have not found the correct one yet, the alert appears even when I do not add a product with the &quot;FRESH&quot; category.</p>
  <p>My idea that it may be misdirected was to verify once a product added to the cart if there is one with &quot;FRESH&quot;, and that there is only one but it is not well raised.</p>
  <p>My wish would be when I add a product to the cart if that product I am adding has the shipping class &quot;Fresh&quot; to notify the customer with a PopUp / alert that says for example. &quot;You have added a FRESH product.&quot;</p>
  <p>thanks for your help</p>
  <pre><code>function action_woocommerce_after_add_to_cart_form_alert_if_cart_add_fresh($product) { 
          
      $shippingclass_array = array( 'fresh' );
      $cart_contain_product_fresh_for_alert = 0;
  
      foreach ( WC()-&gt;cart-&gt;get_cart() as $cart_item_key =&gt; $values ) 
      {
          $shipping_class = get_the_terms( $values['product_id'], 'product_shipping_class' );
          $quantity = $values['quantity'];
  
          if ($quantity &lt; 2 ){
              if ( isset( $shipping_class[0]-&gt;slug ) &amp;&amp; in_array( $shipping_class[0]-&gt;slug, $shippingclass_array ) ) {
                  $cart_contain_product_fresh_for_alert ++; 
                  
              }
          }
      }
  
      if($cart_contain_product_fresh_for_alert === 1 ){
          $freshInCart = true;
          ?&gt;
              &lt;script&gt;
                  jQuery(function($){
                      alert('Se ha añadido un producto fresco a su carrito');
                  });
              &lt;/script&gt;
          &lt;?php
      }
  }; 
  add_action( 'woocommerce_after_add_to_cart', 'action_woocommerce_after_add_to_cart_form_alert_if_cart_add_fresh'); 
  add_action( 'woocommerce_after_add_to_cart_button', 'action_woocommerce_after_add_to_cart_form_alert_if_cart_add_fresh', 10, 1 );
  </code></pre>