type:
snippet
category:
shipping
name:
Automatically selecting returned shipping rate
versions:
0.6.0,
0.7.0,
0.7.1,
0.7.2,
1.0
reference:
http://forum.foxycart.com/discussion/5498/set-default-shipping-method
tags:
snippets,
advance shipping,
liverates
date:
2012-02-05

Automatically selecting returned shipping rate

This script automatically selects the first returned shipping option with live rates, and updates the total price of the checkout accordingly.

Step 1: Add Javascript

Paste the following code right before the closing </head> tag of your checkout template:

<script type="text/javascript">
jQuery(document).ready(function() {
  jQuery(document).ajaxComplete(function(event, request, settings) {
    if (settings.url.indexOf('GetShippingCost') != -1) {
      $("#fc_shipping_methods_inner input[type='radio']:first").prop("checked", true);
      FC.checkout.updatePrice(i);
    }
  });
});
</script>

Related Forum Discussions

snippets/shipping/automatically_selecting_returned_shipping_rate.txt · Last modified: 2013/03/20 21:15 by adam
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki