I’m using the advanced address field in Gravity Forms so the conditional logic option on my tax field doesn’t let me check the state in that advanced field. I can’t make the tax field only show for florida so I have to add the following javascript:

<script>
  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();
       } else {
           $('#field_5_38').hide();
       }
   }); 
   $('#choice_30_0').change(function() {
      var state = $('#input_5_25_4').val();
       state = state.toLowerCase();
       if (state == 'fl' || state == 'florida') {
           $('#field_5_38').show();
       }
   }); 
   $('#choice_30_1').change(function() {
      var state = $('#input_5_25_4').val();
       state = state.toLowerCase();
       if (state == 'fl' || state == 'florida') {
           $('#field_5_38').show();
       }
   }); 
});

1 thought on “Add State Sales Tax for a Specific State with Gravity Forms in WordPress”

  1. Pingback: Charge Tax on Shipping Using Gravity Forms for WordPress - Cullen Web Services

Leave a Comment

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

Scroll to Top