This is an old revision of the document!


type:
snippet
category:
Add to cart form
name:
Automatically adding a coupon code
versions:
060, 072, 071
reference:
http://forum.foxycart.com/comments.php?DiscussionID=1993&page=1
tags:
snippets, shipping, advance
date:
2011-05-25

Automatically adding a coupon code

The code below is for automatically adding a coupon code in the background, on pageload.

function fc_BuildFoxyCart() {
// check for coupon
$.getJSON('http://example.foxycart.com/cart?output=json&cart=view&callback=?' + fc_AddSession(),
function(data){
if (!data.coupons) {
$.getJSON('http://example.foxycart.com/cart?cart=update&coupon=free-special-product-shipping&callback=?' + fc_AddSession(), function(){});
}
 
});
 
return true;
}

For further details, please see the forum link below.

Site Tools