Free Shipping Unless A Coupon is Used

marketing_guymarketing_guy Member
in Help edited July 2013
Hi,

I've put in Free Shipping on a client's site for orders over $100. However, the client doesn't want to offer free shipping if the order is over $100 and the person has entered any coupons (there are two currently).

Is it possible to turn off the free shipping in that case?

www.naturalglowsunless.com (example product coupon page: http://www.naturalglowsunless.com/products/caribbean-cocktail-spray-tan-solution/)

Thanks!
Comments
  • fc_adamfc_adam FoxyCart Team
    @marketing_guy,

    You can use this in your if statement to find out if any coupons are attached:
    fc_json.hasOwnProperty('coupons')
    

    That code will return true if there are any coupons in the cart, false if not.
  • Thanks! Now, being javascript challenged...where does that get placed?
    <script type="text/javascript" charset="utf-8" >
    var myCustomShipping = function() {
      if (fc_json.total_price < 100) {
        // if the requirements *are not* met, then remove the free shipping option.
        jQuery("label[for='shipping_service_60']").remove();
       }
    }
     
    jQuery(document).ready(function() {
      jQuery(document).ajaxComplete(function(event, request, settings) {
        myCustomShipping();
      });
    });
    
  • fc_adamfc_adam FoxyCart Team
    Within your if statement like this:
    if (fc_json.total_price < 100 || fc_json.hasOwnProperty('coupons')) {
    

    That says if the total price is less than 100 or if the order has coupons, remove the shipping rate.
Sign In or Register to comment.