Charge Tax on Shipping Using Gravity Forms for WordPress

After figuring out how to charge tax for only one state , I then needed to include the shipping in the taxable amount.

When I used the calculated field ( ({EMT Code Membership:30} + {Shipping:28} ) * .07 ) in Gravity Forms, the total would not refresh. I looked in the javascript for Gravity Forms and found the function gformCalculateTotalPrice($form_id). I added this function call to my jQuery code using my form ID and all is well. It calculates the tax and adds it to the total as expected.

  jQuery(document).ready(function($) {
   $('#field_5_38').hide();
   $('#input_5_25_4').change(function() {
      var state = $(this).val();
       state = state.toLowerCase();
       if (state == 'fl' || state == 'florida') {
           $('#field_5_38').show();
           gformCalculateTotalPrice('5');
       } else {
           $('#field_5_38').hide();
           gformCalculateTotalPrice('5');
       }
   }); 
   $('#choice_30_0').change(function() {
      var state = $('#input_5_25_4').val();
       state = state.toLowerCase();
       if (state == 'fl' || state == 'florida') {
           $('#field_5_38').show();
           gformCalculateTotalPrice('5');
       }
   }); 
   $('#choice_30_1').change(function() {
      var state = $('#input_5_25_4').val();
       state = state.toLowerCase();
       if (state == 'fl' || state == 'florida') {
           $('#field_5_38').show();
           gformCalculateTotalPrice('5');
       }
   }); 
});

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top