This is an old revision of the document!
Currently Foxy coupons require the customer add them to the cart using a code on the cart or checkout. Sometimes though you'd like to offer a discount automatically to your customers, without them needing to add a code.
To do that, you can add a small bit of javascript to your store, that looks like this:
<script> var FC = FC || {}; FC.onLoad = function () { FC.client.on('ready.done', function () { var code = "YOUR_COUPON_CODE"; if (FC.json.coupons.hasOwnProperty(code)) { FC.client.request('https://'+FC.settings.storedomain+'/cart?coupon=' + code).done(function() { if (FC.util.hasError('coupon')) { FC.util.removeError('coupon'); } }); } }); } </script>
Include that code on your own website, making sure that you're also including the loader.js file for your store. Within that code, you will also need to update the YOUR_COUPON_CODE value to be the code for the specific coupon you're wanting to add automatically.