title: How can I limit a response to a php filter to only one?
body: <p>I created a filter in php for wordpress that displays a special message when a product with a certain shipping class is in the cart. The special message shows up multiple times, for however many products of that class are in the cart. How can I limit the output to only one? Here's the code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> add_action( 'woocommerce_after_checkout_form', 'allclean_add_checkout_content', 12 );
  function allclean_add_checkout_content() {
      // set your special category name, slug or ID here:
      $shippingclass =  array( 'cut' );
      $bool = false;
      foreach ( WC()-&gt;cart-&gt;get_cart() as $cart_item_key =&gt; $values ) {
   $shipping_class = get_the_terms( $values['variation_id'], 'product_shipping_class' );
  
          if ( isset( $shipping_class[0]-&gt;slug ) &amp;&amp; in_array( $shipping_class[0]-&gt;slug, $shippingclass ) ) {
              $bool = true;
      }
      // If the special cat is detected in one items of the cart
      // It displays the message
      if ($bool)
          echo '&lt;div class="example1"&gt;&lt;h3&gt;Items in your cart can be cut to save on shipping. List which items you want cut in your order notes.&lt;/h3&gt;&lt;/div&gt;';
  }
  }</code></pre>
  </div>
  </div>
  </p>