title: Woocommerce fee not multiplying on multiple cart items?
body: <p>This script is adding a fee if the product is in a particular category.<br>
  The script is working but only for one cart item.<br>
  But if there are 2 or more items it wil not multiply in the cart.<br>
  What am I doing wrong?</p>
  <pre><code>add_action( 'woocommerce_cart_calculate_fees','custom_pcat_fee', 20, 1 );
  function custom_pcat_fee( $cart ) {
      if ( is_admin() &amp;&amp; ! defined( 'DOING_AJAX' ) )
          return;
  
      // iPhone CAT
      $iphone_categories = array('74');
      $iphone_fee_amount = 0;
      
      // iPad CAT
      $ipad_categories = array('75');
      $ipad_fee_amount = 0;
  
      
      // Loop through cart items 
      foreach( $cart-&gt;get_cart() as $cart_item ){
          $quantiy = $cart_item['quantity']; //get quantity from cart
          if( has_term( $iphone_categories, 'product_cat', $cart_item['product_id']) )
              $iphone_fee_amount = 4.70 * $quantiy;
          if( has_term( $ipad_categories, 'product_cat', $cart_item['product_id']) )
              $ipad_fee_amount = 2.60 * $quantiy;
      }
  
      // Adding the fee for iPhone
      if ( $iphone_fee_amount &gt; 0 ){
          // Last argument is related to enable tax (true or false)
          WC()-&gt;cart-&gt;add_fee( __( &quot;Thuiskopieheffing iPhone&quot;, &quot;woocommerce&quot; ), $iphone_fee_amount, true );
      }
      // Adding the fee for iPad
      if ( $ipad_fee_amount &gt; 0 ){
          // Last argument is related to enable tax (true or false)
          WC()-&gt;cart-&gt;add_fee( __( &quot;Thuiskopieheffing iPad&quot;, &quot;woocommerce&quot; ), $ipad_fee_amount, true );
      }
  }```
  </code></pre>