Docs › Luv Upsell

Developer API & events

Luv Upsell works on most themes with no code. When you want your own analytics, apps or theme to work with its offers, everything on this page is public and safe to build on.

window.LuvUpsell

Available once Luv Upsell has loaded (listen for luvupsell:ready):

function whenLuvUpsell(fn) {
  if (window.LuvUpsell) fn();
  else document.addEventListener("luvupsell:ready", fn, { once: true });
}
whenLuvUpsell(function () {
  LuvUpsell.on("added", function (d) {
    console.log("Taken from an offer:", d.offer_id, d.placement, d.items);
  });
});

Events

Luv Upsell dispatches these on document. Each event's detail has placement, offer_id, arm ("a" or "b") and items (the product handles in the offer).

document.addEventListener("luvupsell:declined", function (e) {
  console.log("Passed on", e.detail.offer_id, "at", e.detail.placement);
});

Hooks

Define window.LuvUpsellHooks to adjust what Luv Upsell does:

window.LuvUpsellHooks = {
  // Return false to skip showing an offer (ctx: placement, offer_id, arm, items)
  beforeShow: function (ctx) { return true; },
  // Return false to skip an add (items: the lines about to be added)
  beforeAdd: function (items) { return true; },
  // Runs after an add, with the cart
  afterAdd: function (cart) {}
};

Your own checkout buttons and block containers

Test mode works here too: with Test mode on in Settings, open your store with ?luvupsell_test=1 and your live funnels show only to you.

Questions? hi@customerluv.app — a founder answers every message.

Your first two weeks free ×