skip to Main Content

On a shopify PLUS store I’m trying to customize the checkout.liquid at the shipping method select page, so far so good, but my script only works after a refresh. This is probably due to the fact that my script runs before the shipping methods are all loaded 🙁

Is there any event I can listen for, that tells me all shippingmethods have been loaded?

I tried to use the shopify.onCartupdate event, because once the shipping methods are loaded the first one is applied to the checkout by default (added to the checkout total) but unfortunately, and maybe logicallly the checkout does not update the cart for the shipping method.

Any help would be appreciated.

2

Answers


  1. Shipping methods are always loaded AFTER your checkout.liquid renders. So you cannot affect them. Whatever you are trying to do, you will have to monkey patch in Javascript world. And even then, good luck. I am not sure there is even an event you can subscribe to labelled shippingMethodsReady kind of thing.

    Login or Signup to reply.
  2. Super late answer however you can use this new snippet.

    Checkout.$(document).on('page:change', function() {
      // ...
    });
    

    Inside the call back function you can run any code, or use window.location to determine which page you’re on specifically. Needs to be run on checkout.liquid meaning Plus stores only.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search