title: Update fee dynamically in Woocommerce checkout
body: <p>Based on this code : <a href="https://stackoverflow.com/questions/49457961/update-fee-dynamically-based-on-radio-buttons-in-woocommerce-checkout/51090255#51090255">Update fee dynamically based on radio buttons in Woocommerce checkout</a> I am trying to have a dynamic conditional percentage fee in my checkout page on Woocommerce, based on 3 conditions:</p>
  
  <p>Here is my actual custom code:</p>
  
  <pre><code>add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
  function woocommerce_custom_surcharge() {
  global $woocommerce;
  
  if ( is_admin() &amp;&amp; ! defined( 'DOING_AJAX' ) )
      return;
  
  $percentage3 = 0.01;
  $fee3 = ( $woocommerce-&gt;cart-&gt;cart_contents_total + $woocommerce-&gt;cart-&gt;shipping_total ) * $percentage3;
  $woocommerce-&gt;cart-&gt;add_fee( 'Fee 3', $fee3, true, '' );
  
  $percentage2 = 0.02;
  $fee2 = ( $woocommerce-&gt;cart-&gt;cart_contents_total + $woocommerce-&gt;cart-&gt;shipping_total ) * $percentage2;
  $woocommerce-&gt;cart-&gt;add_fee( 'Fee 2', $fee2, true, '' );
  
  $percentage1 = 0.03;
  $fee1 = ( $woocommerce-&gt;cart-&gt;cart_contents_total + $woocommerce-&gt;cart-&gt;shipping_total ) * $percentage1;
  $woocommerce-&gt;cart-&gt;add_fee( 'Fee 1', $fee1, true, '' );
  }
  </code></pre>
  
  <p>But It doesn't work… How can I make it work like in the linked answer?</p>