Solved

Dynamic Coupon Auto Apply to Cart

  • 10 December 2021
  • 2 replies
  • 828 views

Badge +3

Hi guys,
Can I use a dynamic coupon created by Klaviyo for automatic application to the cart?
Caution. I use it for the cross-sell flow and not for the abandoned cart flow.

Now I use a code like this with static coupon:
https://mysite.myshopify.com/cart/42117860458721:1?channel=buy_button&discount=DISCOUNT50

This code does not open the cart with the abandoned cart, but opens the cart with a specific product identified by the code 42117860458721: 1

Can I use a dynamic coupon created by klaviyo, instead a static copuon created by shopify for create a address like this?

I would like to create a button that, when click on it, open a cart with a specific product and a dinamic coupon already applied.

is it possible to do this?

Thanks

icon

Best answer by David To 10 December 2021, 20:24

View original

2 replies

Userlevel 7
Badge +60

Hello @Giuseppe8910,

Great call out that you planned on using this with a cross sell flow! Unlike an abandoned cart flow where Klaviyo is shared a cart ID or a unique checkout link which would offer the capability to rebuilt and retrieve a cart, this would not be possible in any other flows or emails. However, you can come close!

Similar to the dynamic URL you are using which applies a static code and directs users to the product page, the same method can actually be used with a dynamic coupon code. To accomplish this, you can use the mysite.com/discount/{% coupon_code 'CouponName' %}?redirect=/new-path URL structure as mentioned in the How to Add Link that Applies a Coupon Code to a Shopify Cart Help Center article.

In a similar fashion, instead of redirect users to a product page with the dynamic discount code applied, you can redirect the users to your generic cart page. Keep in mind though, since this URL structure would be unable to rebuild the user’s abandoned cart, this link would only take users back to their own cart page during their existing session. What this means is that if a contact had not added any items in their cart or they’ve cleared their cookies and click on this link with a discount code, they would be brought back to an empty cart page with the discount code applied. But, if the contact previously had items in the cart and were still cookied, then the items would still remain when redirected back to the page; once again with the unique discount code applied. This also extends to contacts who clicked on the link from an alternate device such as a a cell phone as going to the cart page. When reaching this page from that from an alternate device, this would be counted as a different session as the existing cookies would not extend to this new device.

There’s been several other post pertaining to this topic which I’ve included below that may shed some more light on this subject as well!

I hope this helps!

David

Badge +3

If it is not possible to generate an address that opens the checkout page with a specific product that I I have decided, with dynamic coupon already applied ... then I will continue to use the static coupons of shopify

Reply