Skip to main content

Hello, 

 

I am using Klaviyo with Shopify. However, when I create a dynamic coupon within Klaviyo and add it to a button in the email, the coupon is sometimes not automatically applied at checkout. The coupon is active, and there are no issues with its settings. Sometimes, it redirects to the checkout page and then activates the coupon. 

 

The second code below sometimes redirects to the homepage instead of the checkout page. The first code definitely redirects to the checkout page.

 

What I want is simple:

When a user clicks the button in the email, they should be redirected to the checkout page and the dynamic coupon should be automatically applied.

I've read a lot of forum posts about this, but unfortunately none of them have worked for me.

I’d really appreciate any help or suggestions you could offer.

Thanks in advance!

 

note: I am experiencing these issues with the Klaviyo abandoned cart.

 

 

{% with event.extra.line_items as items %}

  {{ organization.url|trim_slash }}/cart/{% for item in items %}{{ item.variant_id }}:{{ item.quantity|floatformat:'0' }}{% if not forloop.last %},{% endif %}{% endfor %}?checkout%email]={{ email }}&discount={% coupon_code 'UC_7_36h' %}

{% endwith %}

 

------------------------------------

{{ event.extra.checkout_url }}&discount={% coupon_code 'UC_7_36h' %}

Hey ​@novajetsoft,

You mentioned that you’re using this coupon in an Abandoned Cart flow. Is the flow triggered by Added to Cart, or Checkout Started? If it’s triggered by Added to Cart, it is expected that {{ event.extra.checkout_url }} won’t direct people to the checkout page, since the Added to Cart event doesn’t actually build a checkout URL. Only the Checkout Started event does this.

If you are using the Checkout Started event as the trigger, have you noticed this issue happening upon actual email sends, or only when previewing the email in the flow or sending a test? If you’re only seeing the issue when previewing/sending a test, this could be happening for a couple reasons. Firstly, if you’re previewing the email as a customer who’s already made a purchase after starting a checkout, the checkout URL won’t work, and will just direct you back to the homepage. Additionally, Shopify can take up to 10 minutes to set the checkout URL live, so if you’re previewing with a very recent event, the checkout URL might not be up and running yet. Because of this, when clicking the link, you’ll be taken to the homepage, and Klaviyo can’t ensure that a coupon will be auto-applied to checkout, if you’re sent to a different page before the checkout page.

In short, if your flow is triggered by Checkout Started, {{ event.extra.checkout_url }}&discount={% coupon_code 'UC_7_36h' %} should work upon an actual send to your customers, even if it doesn’t appear to work when testing. If you’re not seeing this behavior, let me know!

-Byrne


Reply