Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Free shipping workaround not being applied

sccr410sccr410 Member
in Bugs & Feature Requests edited January 2012
I have the following JavaScript added to my checkout template file in the (also includes the code to make phone required). We offer free shipping for orders over $65, and flat rate $10 for all other orders. At checkout, it displays the proper free shipping. However, on the receipt page and confirmation email it always applies the $10 shipping no matter what. I am not allowed to show off the development URL as per my client agreement until this site goes live unfortunately.

<script type="text/javascript" charset="utf-8">
FC.checkout.config.customShipping = {
onLoad: true, // Set to false if you don't want shipping calculated when the checkout loads
onLocationChange: false // Set to true if your shipping logic relies on updating whenever the shipping location for the order changes
};

function calculateShipping() {
var shippingCost = 0;

/* BEGIN CUSTOM SHIPPING LOGIC */
var total = fc_json.total_price;

if (total <= 65) {
shippingCost = 10;
} else {
shippingCost = 0; // Free shipping because they bought so much
}

/* END CUSTOM SHIPPING LOGIC */

FC.checkout.config.orderFlatRateShipping = shippingCost;
FC.checkout.updateShipping(-1);
}

jQuery(document).ready(function() {
if (FC.checkout.config.customShipping.onLoad) {
calculateShipping();
}

if (FC.checkout.config.customShipping.onLocationChange) {
FC.checkout.overload("updateTaxes", function() { calculateShipping(); }, null);
}

// add the required class
jQuery("#customer_phone").addClass("fc_required");
// add an asterisk to the label
jQuery("li.fc_customer_phone label.fc_pre").append("<span class=\"fc_ast\">*<\/span>");
// Now add the onblur error checking events
jQuery("#customer_phone").blur(function() {
if (this.value == "") {
FC.checkout.updateErrorDisplay(this.name,true);
} else {
FC.checkout.updateErrorDisplay(this.name,false);
}
});
});

Tagged:
Comments
Sign In or Register to comment.