Magento: Set default shipping method

For those of you looking for the same thing…

I added a small bit of javascript to /app/design/frontend/default/XXXXX/template/checkout/onepage/shipping_method.phtml. The script will automatically check the shipping method button when the user clicks continue. It is added to the continue button in the shipping section as an onclick event. Here is the code…

YOU’LL NEED TO CHANGE “XXXXX” IN THE CODE BELOW TO THE ID OF THE SHIPPING METHOD BUTTON. To find the id of the button, take a look at the source code of the checkout page in your browser. It will look something like this…

 <input type="radio" class="radio validation-passed" id="XXXXX" value="freeshipping_freeshipping" 
name
="shipping_method">

Copy the id of the button and use it to replace “XXXXX” below…

 document.getElementById('XXXXX').checked=true; 

Here is the code in context…

 <!-- BOF MOD AUTO CHECK SHIPPING BUTTON ON CONTINUE -->
<
button type="button" class="button" onclick="document.getElementById('XXXXX').checked=true;
shippingMethod.save()"
><span><?php echo $this->__('Continue') ?></span></button>
<!--
EOF MOD AUTO CHECK SHIPPING BUTTON ON CONTINUE -->

Make sure that the new code is placed BEFORE “shippingMethod.save()”. And don’t forget the “;”. I hope that this helps someone besides just me.

Site Search

Who's Online

Abbiamo 33 visitatori e nessun utente online

Stats

Visite agli articoli
161162
banner mym
banner mym