title: Show custom checkout fields if a specific product is in cart on Woocommerce
body: <p>So I have some custom fields in my billing section on the checkout page, that I only want to display if a product with ID (603) is in the cart.</p>
  
  <p>Currently, my code below works to hide the fields if there is a product in the cart that is not id 603, but one issue is when I have 603 and another product in the cart it unsets the fields,</p>
  
  <p>what is the best way to either hide the fields if 603 is not in the cart or to just show them if it is?</p>
  
  <p>this is the current code I was using</p>
  
  <pre><code>    function conditional_checkout_fields_products( $fields ) {
          $cart = WC()-&gt;cart-&gt;get_cart();
  
          foreach ( $cart as $item_key =&gt; $values ) {
              $product = $values['data'];
  
              if ( $product-&gt;id != 603 ) {
                  unset( $fields['billing']['billing_prev_injuries'] );
                  unset( $fields['billing']['billing_dogs_events'] );
                  unset( $fields['billing']['billing_dogs_age'] );
                  unset( $fields['billing']['billing_dogs_breed'] );
                  unset( $fields['billing']['billing_dogs_name'] );
                }
          }
  
          return $fields;
      }
  add_filter( 'woocommerce_checkout_fields', 'conditional_checkout_fields_products' );
  </code></pre>