title: WooCommerce Non-Recurring Subscription Fees
body: <p>I am using WooCommerce subscriptions plugin in WooCommerce. I am trying to write a function to perform a 10% discount on <strong>normal products</strong> when <strong>one of</strong> the following conditions are met:</p>
  
  <ol>
  <li>The User Has an Active Subscription</li>
  <li>The User has a Subscription Product in his cart</li>
  </ol>
  
  <pre class="lang-html prettyprint-override"><code>function vip_discount() {
  
      $woocommerce = WC();
      $items = $woocommerce-&gt;cart-&gt;get_cart();
      $vip_product_id = get_subscription_product_id();
      $is_vip_in_cart = is_in_cart($vip_product_id);
      $vip_product_price = 0;
  
      foreach ($items as $item) {
          if( $item['variation_id'] === get_subscription_variation_id('monthly') || $item['variation_id'] === get_subscription_variation_id('quarterly') || $item['variation_id'] === get_subscription_variation_id('annually') ) {
              $vip_product_price = $item['line_total'];
          }
      }
  
      if ( wcs_user_has_subscription( '', '', 'active' ) || $is_vip_in_cart ) {
          // Make sure that the calculation is a negative number at the end ALWAYS!
          $discount = -( 10 / 100 ) * ( $woocommerce-&gt;cart-&gt;get_displayed_subtotal() - $vip_product_price);
          print_r($discount);
          $woocommerce-&gt;cart-&gt;add_fee( 'VIP Discount', $discount );
      }
  }
  add_action( 'woocommerce_cart_calculate_fees', 'vip_discount' );
  </code></pre>
  
  <p>The problem is that this hook is for some reason run twice. Also it's not applying the correct fee. It's supposed to subtract the recurring items total from the negatively applied fee, instead the fee is ending up as the subscription (recurring) product price itself.</p>
  
  <p>Any supplementary information or help is appreciated.</p>