title: On country change ajax update checkout for shipping in Woocommerce
body: <p>I'm looking for a way to update order review (shipping price) when client change country on checkout page.
  I want to use jQuery. but <strong>wc_checkout_params</strong> wc_checkout_params is deprecated.</p>
  
  <pre><code>function custom_checkbox_checker() {
  
      if (is_checkout()) {
  
          wp_enqueue_script('jquery');
          ?&gt;
  
          &lt;script type="text/javascript"&gt;
  
              jQuery(document).ready(function (e) {
  
                  var $ = jQuery;
  
          // wc_checkout_params is required to continue, ensure the object exists
  
                  if (typeof wc_checkout_params === 'undefined')
                      return false;
  
                  var updateTimer,
                          dirtyInput = false,
                          xhr;
  
  
  
                  function update_shipping(billingstate, billingcountry) {
  
                      if (xhr)
                          xhr.abort();
  
                      $('#order_methods, #order_review').block({message: null, overlayCSS: {background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6}});
  
                      var data = {
                          action: 'woocommerce_update_order_review',
                          security: wc_checkout_params.update_order_review_nonce,
                          billing_state: billingstate,
                          billing_country: billingcountry,
                          post_data: $('form.checkout').serialize()
  
                      };
  
  
  
                      xhr = $.ajax({
                          type: 'POST',
                          url: wc_checkout_params.ajax_url,
                          data: data,
                          success: function (response) {
  
                              var order_output = $(response);
  
                              $('#order_review').html(response['fragments']['.woocommerce-checkout-review-order-table'] + response['fragments']['.woocommerce-checkout-payment']);
  
                              $('body').trigger('updated_checkout');
  
                          },
                          error: function (code) {
  
                              console.log('ERROR');
  
                          }
  
                      });
  
                  }
  
  
  
                  jQuery('.state_select').change(function (e, params) {
  
                      update_shipping(jQuery(this).val(), jQuery('#billing_country').val());
  
                  });
  
  
  
              });
  
          &lt;/script&gt;
  
      &lt;?php
  
      }
  }
  
  add_action('wp_footer', 'custom_checkbox_checker', 50);
  </code></pre>
  
  <p>any clue?</p>
  
  <p>All solutions related to AJAX for WC like <a href="https://stackoverflow.com/questions/30297049/woocommerce-add-a-custom-fee-using-ajax-to-cart-totals-on-checkout-page/30319413">this</a> are useless since wc_checkout_params removed on 3.x version.</p>
  
  <p>Nothing useful found in woocommerce documentations. 
  nothing in stack overflow!</p>
  
  <p>wondering why no one answered questions like <a href="https://stackoverflow.com/questions/35481225/how-to-use-woocommerce-wc-ajax-class">this</a> for 2 years+</p>