I need to load some jquery code on checkout after the shipping methods are loaded. This code is going to auto-select a ship method and hide the others. How can you observe checkout steps in Magento in JavaScript? Right now I have the code within a document.ready but since the shipping methods are not showing yet on first page of checkout of course the code will not work.

2 Answers 2


Welcome to Magento.SE! Perhaps what you need to do is disable all shipping methods first? When Magento has only one shipping method available then it is selected by default:

Single method enabled

  1. Shipping method enabled:

enter image description here

  1. Displayed in checkout:

enter image description here

Compare this to when more than one is enabled

enter image description here


I needed to do the same thing, and the easiest way I found was to do this:

  • Copy the checkout/onepage/shipping_method/available.phtml template to your theme's scope

  • Add your custom Javascript code to the script block at the end of that template

Since the template is only loaded when the user reaches the shipping method step, the Javascript will only be executed at that point, which is exactly my requirement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.