title: Alert in add_filter WordPress
body: <p>I found this function to only let 1 product be in cart at a time.
  It works fine but I want to alert something in jQuery in the function.</p>
  
  <pre><code>add_filter( 'woocommerce_add_to_cart_validation', 'bbloomer_only_one_in_cart', 99, 2 );   
  function bbloomer_only_one_in_cart( $passed, $added_product_id ) { 
     wc_empty_cart();
     return $passed;
  
      $message = "Add only 1 product";
      echo "&lt;script type='text/javascript'&gt;alert('$message');&lt;/script&gt;";      
  }
  </code></pre>
  
  <p>Can someone help me to do this?</p>