−Table of Contents
Handling fee on orders under $100, free if over, live rates included.
Using version 2.0? There is a new snippet available for our latest version, available from here.
This javascript allows you to add different amounts to shipping costs based on the carrier that the customer has chosen. This particular setup also provides free shipping if the order is over a certain price.
Step 1: Javascript
Paste the following right before the closing </head>
tag in your checkout template. You'll need to edit the script to show the values you want to add for each carrier.
<script type="text/javascript"> function updateMyShippingCost() { // Grab current shipping cost (from live rates) var shippingCost = FC.checkout.config.orderShipping; // Grab currently selected shipping option var carrier = $("input[name=shipping_service]:checked").siblings(".fc_shipping_carrier").html(); if ( carrier != null ) { // something is selected if ( carrier == "FedEx" ) { // it's FedEx! shippingCost += 10; } else if ( carrier == "UPS" ) { // it's UPS! shippingCost += 3.5; if (fc_json.total_price >= 100) { // Free shipping! shippingCost = 0; } } } // Update the shipping cost with the updated figures FC.checkout.config.orderShipping = shippingCost; } jQuery(document).ready(function(){ // set the custom function to run before the updatePriceDisplay function FC.checkout.overload("updatePriceDisplay", "updateMyShippingCost", null); }); </script>