0

How to change default shipping method on button click (ajax call) on checkout page?

7ochem
7,61516 gold badges54 silver badges82 bronze badges
asked Jun 9, 2014 at 9:59
2
  • Do you want to preselect a different shipping method depending on user input, or just change the default selected method globally? Commented Jun 9, 2014 at 13:58
  • @alex.ayg, First one. depending on user input? Commented Jun 11, 2014 at 5:14

1 Answer 1

1

You can do this from both PHP or JavaScript

If you go the PHP way, you need to edit the app/design/frontend/[package]/[theme]/template/checkout/onepage/shipping_method/available.phtml file, and around line 47 you have an if statement

if($_rate->getCode()===$this->getAddressShippingMethod())

when this condition returns true, it will set the corresponding method as selected. So you can update the if statement, and check other condition as well

If you want to go the JavaScript way, you need to edit the skin/frontend/base/default/js/onepagecheckout.js file

answered Jun 11, 2014 at 14:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.