• Resolved Rose

    (@thorned-rose)


    At some point, the shipping stopped updating upon region field selection change. i.e. when selecting a different region, the shipping options should be updated via Ajax, however this doesn’t happen. Nothing happens.

    I have tried disabling Cloudflare and Litespeed cache, purging cache; switching to the Storefront theme; enabling troubleshooting mode with only Woocommerce enabled. But even in troubleshooting mode with only Woocommerce plugin enabled, the problem persists.

    Here’s a screen record showing that in troubleshooting mode with the Storefront theme, there is no ajax update: https://ibb.co/fH3Gv2Z

    I don’t know at what point this started happening but it’s relatively recently.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Rose

    (@thorned-rose)

    Enabling debug mode does not come up with anything relevant. And the ajax is loaded as it works correctly to update the total when changing between shipping options (pickup and courier)

    • This reply was modified 5 years, 5 months ago by Rose.
    Thread Starter Rose

    (@thorned-rose)

    From what I am understanding, a customer has to fill in all required address fields before the shipping will update. The problem with this however is that my shipping zones are based solely on Region (State) so it seems silly not to update the shipping after region is selected. I can either add some custom code to force an update when region is selected. Or use the “Hide shipping costs until an address is entered” option. Neither is ideal. So I am wondering, why is it not part of core Woocommerce for areas that have shipping based on Region or State to send an ajax update when Region/State is selected??

    Thread Starter Rose

    (@thorned-rose)

    In case anyone else wants this, here is what I have to force updates on Region/State select:

    function update_woocommerce_shipping_region_change(){
      if ( function_exists('is_checkout') && is_checkout() ) {
        ?>
        <script>
          window.addEventListener('load', function(){
            var el = document.getElementById("billing_state_field");
            el.className += ' update_totals_on_change'; 
          });
        </script>
        <?php 
      }
    }
    add_action('wp_print_footer_scripts', 'update_woocommerce_shipping_region_change');

    Hello @thorned-rose,

    I appreciate you sharing your solution to this situation. WooCommerce does not have a way of detecting patterns in how the shipping zones are set up. It doesn’t check and see if they are all state-based and then change the AJAX refresh based on that. Right now the only option would be a custom solution like you’ve created.

    Thanks again for contributing!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Checkout shipping costs not updating (Ajax)’ is closed to new replies.