The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Customers are getting charged shipping when it should be free!

davidzupecdavidzupec Member
in Help edited October 2014
Hello, I have it set up so that customers in certain zip codes in new york will get free shipping. It was working fine and then suddenly today they're getting charged for shipping. The strange thing is that some of those zip codes work fine and display free shipping and others don't! Here's my code below if you can help. Thank you!
  FC.customLiveShipping = {}
  FC.customLiveShipping.config = {
    autoSelect: true  // Set to true if you'd like the top shipping option to be automatically selected for the user
  FC.customLiveShipping.logic = function() {

		var beverages  = 0;
    var multiplier = 1
    for ( p in fc_json.products ) {
      switch ( fc_json.products[p].category ) {
        case "BEVERAGE":
          beverages += fc_json.products[p].quantity;
    if ( beverages > 0 ) { 
      multiplier = Math.ceil( beverages / 6 ); // 1-6 > 1, 7-12 > 2, 13-18 > 3, etc
      FC.customLiveShipping.update('all', '+' + ( multiplier * 13 ) );
      FC.customLiveShipping.update(60, 0);
		var zip = (jQuery("#use_different_addresses").is(":checked") ? $("#shipping_postal_code").val() : $("#customer_postal_code").val());
		var valid_zips = [11362,11355,11366,11423,11102,11375,11692,11005,11415,11369,11415,11369,11771,11582,11593,11216,11228,11219,11239,11229,11215,11225,11237,10030,10018,10017,10014,10006,10009,10044,10025,10033,11363,11356,11367,11432,11103,11379,11693,11411,11416,11370,11416,11370,11583,11594,11233,11230,11235,11217,11226,10037,10019,10022,10007,10128,10034,11364,11357,11433,11104,11385,11694,11413,11417,11372,11417,11372,11595,11238,11231,10039,10020,10038,10040,11358,11434,11105,11695,11422,11418,11373,11418,11373,11597,10036,10280,11359,11435,11106,11697,11426,11419,11377,11419,11377,11360,11436,11427,11420,11378,11420,11378,11428,11421,11421,11429];
		if (jQuery.inArray(parseInt(zip), valid_zips) > -1) {
		  var hasCoupon = false;
		  if(fc_json.hasOwnProperty('coupons')) {
		    jQuery.each(, function(i, coupon){
		      if( > -1) {
		        hasCoupon = true;
		  if (fc_json.product_count > 0 || hasCoupon) {
		    // If valid zips and 1 product or more or a free ship coupon
  • fc_adamfc_adam FoxyCart Team

    Could you confirm what store this is for? Feel free to whisper if you want to keep it private.
  • fc_adamfc_adam FoxyCart Team

    Thanks for whispering that - looking at your checkout, the valid_zips array is different within your checkout to what you pasted above - which is why you're seeing some of those zips fail. The ones that do work must be present in both of the arrays, the one you're referencing above and the one actually in your checkout.
  • davidzupecdavidzupec Member
    edited October 2014
    Hi Adam, I didn't paste in all the zip codes in the code above because I wasn't sure if that would make for too much code to insert on here If I pasted them all in because there are quite a few of them.
  • fc_adamfc_adam FoxyCart Team

    Spot checking a few of the zips in what you pasted though, they don't match up with what you actually have in your checkout. What zips are you expecting to work that aren't?
  • Hey Adam, I had went in to foxy cart checkout in the admin and seen that I didn't add in all the zips that were from my html file! Completely my fault, I thought I had transferred them all over. So I just did that now and all zips are working correctly. Thank you Adam!
Sign In or Register to comment.