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.

Free Shipping Coupon with custom multiple flat shipping rates

babblebibbabblebib Member
in Help edited September 2012
Is it possible to give users a 'free shipping' coupon that can be used in conjunction with the Multiple Flat Rate code snippet http://docs.foxycart.com/snippets/shipping/multiple_flat_rates.

The issue i have is that my shipping is calculated via java script on my checkout page, and my understanding is that the coupons have already been applied at that stage?
Comments
  • fc_adamfc_adam FoxyCart Team
    @babblebib,

    You can mix the free shipping coupon functionality found on the snippets page with the multiple flat rates snippet to get the functionality you're after: http://wiki.foxycart.com/snippets/start
  • Hi @fc_adam, thanks for your note.

    I've added the free shipping sample to my checkout page. I've tried putting the JS both before and after the multiple flat rate shipping options, but it does not work in either case. :(

    My site is http://goo.gl/AacV6, is there any chance you could take a look to see i am going wrong?
  • fc_adamfc_adam FoxyCart Team
    @babblebib,

    Sorry, I should have been more specific. You needed to actually mix it into what you're currently doing, not include it as it is. The particular snippet you're using is for live rates, where as you're utilising flat rate shipping.

    What I'd suggest would be to add this into your little getShippingOptions function:
    if (fc_json.hasOwnProperty('coupons')) {
        jQuery.each(fc_json.coupons, function (i, coupon) {
            if (coupon.name.search(/free shipping/i) > -1) {
                returnArray.push(new Array(0.00, "Free Shipping"));
            }
        });
    }
    
  • @fc_adam

    H, that code snippet you gave me works perfectly, thanks!

    Now it is time to get to work on all those 'free shipping' xmas promotions!! :)
Sign In or Register to comment.