For the complete documentation index, see llms.txt. This page is also available as Markdown.

Dynamically Apply Discounts

Apply a discount to your checkout automatically or when the user clicks a particular link or button

This can be used for things like:

  • Reduce checkout abandon – Show an exit-intent popup that offers a discount if they checkout

  • Incentivize repeat purchases – Automatically apply a discount for logged in users

  • Reinforce an affiliate sale – Automatically apply a discount for users referred by an affiliate

Custom code might not be needed! Spiffy will automatically apply discounts/coupons passed through the URL using ?code=MYCOUPON or ?c=MYCOUPON – this works on Spiffy.js and the hosted checkout

With Spiffy.js on the page, a code on the current page's URL is also carried onto your Spiffy checkout links for you, so a ?code= on your ad URL reaches the checkout without any code of your own. Two things to know: a code written directly on a checkout link wins over the one on the page URL, and the code is only added to Spiffy checkout links, never to links pointing elsewhere.

Apply Discount Immediately

If you want to apply a discount immediately but need some additional logic around when to apply it or what coupon to apply (eg, only apply for particular campaigns or particular affiliates) you can do so like this:

// wait for Spiffy to be ready
spiffy.on('ready', function () {
    // identify the checkout you want to apply the discount to
    spiffy.checkout("https://yourcompany.spiffy.co/checkout/test-checkout", {
        // apply the coupon!
        coupon: 'MYCOUPON'
    })
})

Using Logic with Discounts

You can leverage some logic for determine when to apply:

Or apply different discounts in different scenarios:

Apply Discount on Interaction

In some cases you may prompt a user to 'claim' a discount or promotion (eg, an exit popup). To do this you can simply use native click event listeners on a buttons, links, and any other elements to apply your discount.

All of these same ideas and methods work for doing all sorts of things to your checkouts such as setting the customer, etc!

Last updated