Flat Rate Shipping + Free Local Delivery for Specific Zip

RevConceptRevConcept Member
in Help edited December 2013
Hey guys,

Trying to get Free shipping added to the checkout if the shipping zip code is equal to "28277". From what I found in the forums/documentaion I see you can do this with live shipping rates...but we want a $5.00 flat rate.

I was able to get this working with the live rates, but again...it's showing $39 USPS - or - Free local delivery. How can I get this working with flat rates?

Here is the shipping logic I have just so you have something to reference:
        var zip = (jQuery("#use_different_addresses").is(":checked") ? $("#shipping_postal_code").val() : $("#customer_postal_code").val());
        var valid_zips = [28277];
         
        if (jQuery.inArray(parseInt(zip), valid_zips) === -1) {
          // Not in the free shipping zip range
          FC.customLiveShipping.remove(60);
        }

Comments
  • fc_adamfc_adam FoxyCart Team
    @RevConcept,

    I'd suggest using the tiered flat rate shipping snippet available from our wiki here: http://wiki.foxycart.com/snippets/start - and then set the flat rate you want using that (after setting your categories to $0 as the documentation mentions in that snippet) and then set it to 0 if the postcode matches like you have in that script above.
  • Thanks for your reply. I got this setup, please forgive my lack of Javascript knowledge...this is my custom shipping logic, which doesn't work for the zip code I've entered. I'm sure I have this setup incorrectly.
    var zip = (jQuery("#use_different_addresses").is(":checked") ? $("#shipping_postal_code").val() : $("#customer_postal_code").val());
     
            switch (zip) {
              case 28277:
                shippingCost = 0;
                break;
              default:
                shippingCost = 5;
            }
    
  • winstonwinston FoxyCart Team
    @RevConcept

    Not a problem, no need to be apologetic. I think the only issue with your logic is that you need to wrap the case in quotation marks, so it'd be like this:
    var zip = (jQuery("#use_different_addresses").is(":checked") ? $("#shipping_postal_code").val() : $("#customer_postal_code").val());
    
            switch (zip) {
              case "28277":
                shippingCost = 0;
                break;
              default:
                shippingCost = 5;
            }
    

    Let me know if that works!
  • RevConceptRevConcept Member
    edited December 2013
    I had tried it both ways. Neither worked.
  • @winston

    I tried this again with the quotes to double check, it doesn't work. The default of $5 does work, however. It just doesn't update when I use the 28277 zip.
  • fc_adamfc_adam FoxyCart Team
    @RevConcept,

    Could you link us to your checkout to give this a test?
  • fc_adamfc_adam FoxyCart Team
    @RevConcept,

    Change this line:
    onLocationChange: false
    

    To be 'true' instead of 'false'.
  • Geez. Haha...I wasn't even looking outside of the custom logic. Thanks!!! It's working ;)
Sign In or Register to comment.