I want to be able to embed a discount in the dynamically generated links.
How do I slice the path out of {{ event.URL }}?
ex: www.xyzcorp.com/discount/SAVE?redirect={{ event.URL | slice path }}
I want to be able to embed a discount in the dynamically generated links.
How do I slice the path out of {{ event.URL }}?
ex: www.xyzcorp.com/discount/SAVE?redirect={{ event.URL | slice path }}
Hi there
Welcome to the Community, happy to help!
These helpful threads will walk you through how to add a coupon to your dynamic cart rebuild link!
Thanks for participating in the Community!
-Taylor
Thank you, but none of these will work for the retargeting {{ event.URL }} calls. I am attempting a work-around using the Shopify technique you referenced above, but I need to remove the URL and retain the Path in order for that to work.
I’ve seen the coding to remove the URL from a dynamic call, but I cannot relocate it. It was something along the lines of splitting.
Hey
Sounds like you’re referencing the slice
filter. You can find that resource in our Glossary of variable filters Help Center article.
In my experience, I find it typically works best if you keep your URL as static as possible or by simply adding the dynamic coupon aspect to the end of the URL being pulled dynamically from your event data.
David
Hey
Sounds like you’re referencing the slice
filter. You can find that resource in our Glossary of variable filters Help Center article.
In my experience, I find it typically works best if you keep your URL as static as possible or by simply adding the dynamic coupon aspect to the end of the URL being pulled dynamically from your event data.
David
Can you show me an example of your recommendation? I haven’t been able to add a coupon to the end of any URL except one going to the home page or cart. I’m looking for a way to attach one to a product page.
Thanks!
Hey
I would recommend checking out our How to add link that applies a coupon code to a Shopify cart Help Center article. Specifically the Apply a discount code and link to checkout and Apply a discount code and link to another page on your site sections.
Apply a discount code and link to checkout
Shopify syncs the Checkout Started event to Klaviyo with a Checkout URL property, which links back to each customer's unique cart. If you are sending Abandoned Cart emails (triggered by the Checkout Started event) and would like to link a customer to their abandoned cart with a discount code added, add the following snippet:
Static Shopify coupon link structure:
{{ event.extra.checkout_url }}&discount=CouponName
Klaviyo-generated coupon link structure:
{{ event.extra.checkout_url }}&discount={% coupon_code 'CouponName' %}
Apply a discount code and link to another page on your site
You may want to apply a discount code to a shopping session, such as a collection page or another page on your site, rather than link the customer directly back to your homepage or rebuild the customer's abandoned cart.
In this case, you can use one of the following URL structures:
mysite.com/discount/CouponName?redirect=/new-path
mysite.com/discount/{% coupon_code 'CouponName' %}?redirect=/new-path
With either structure, replace:
- mysite.com with your website
- CouponName with the name of your coupon
- new-path with the desired URL extension. For example, if you would like to link someone to a specific collection page, you would use
?redirect=/collections/mycollection
Similar to what is documented, if you’re trying to add a discount code to a dynamic URL that’s already being pulled in from your event, you can append either &discount=CouponName
or &discount={% coupon_code 'CouponName' %}
.
Since you’re trying to append a discount code to a product page, I would advise following the directions listed in the Apply a discount code and link to another page on your site sections as it’s pretty specific. The example it offers even shows you how you can bring users back to the collection page.
David
Apply a discount code and link to another page on your site
You may want to apply a discount code to a shopping session, such as a collection page or another page on your site, rather than link the customer directly back to your homepage or rebuild the customer's abandoned cart.
In this case, you can use one of the following URL structures:
mysite.com/discount/CouponName?redirect=/new-path
mysite.com/discount/{% coupon_code 'CouponName' %}?redirect=/new-path
This is what I’m trying to get at and perhaps I’m having trouble explaining myself.
On a Browse Abandonment Flow, the product links are “{{ event.URL }}”. In the above examples, I need to define the redirect “new-path”. I want to know if I can filter the path from the {{ event.URL }} in order to get the “new-path”.
I’m not going to checkout, so {{ event.extra.checkout_url }}&discount=CouponName does not work.
For anyone interested, here’s the answer on how to achieve the question at hand.
This is what the link should look like in the Browse Abandon Flow where the dynamic {{ event.URL }} is used with Shopify.
https://www.YOURWEBSITE.com/discount/YOURDISCOUNT?redirect={{ event.URL|cut:'https://www.YOURWEBSITE.com' }}
You can also use Shopify’s permalink feature https://help.shopify.com/en/manual/products/details/cart-permalink
We use them at Zaymo especially with our Interactive AMP and HTML emails because if a customer edits their order in the email, we want that to be reflected on the shopify payment page
You can also use Shopify’s permalink feature https://help.shopify.com/en/manual/products/details/cart-permalink
We use them at Zaymo especially with our Interactive AMP and HTML emails because if a customer edits their order in the email, we want that to be reflected on the shopify payment page
I was not successful using this on a Product Page. Makes sense for the Cart links. Thanks!
https://www.YOURWEBSITE.com/discount/YOURDISCOUNT?redirect={{ event.URL|cut:'https://www.YOURWEBSITE.com' }}
This applies the discount but sends people to the homepage, not the event page.
https://www.YOURWEBSITE.com/discount/YOURDISCOUNT?redirect={{ event.URL|cut:'https://www.YOURWEBSITE.com' }}
This applies the discount but sends people to the homepage, not the event page.
Are you using this where the {{ event.URL }} is typically generated? Specifically in an Abandoned Cart Flow? It’s working fine when an {{ event.URL }} is being generated and used in Klaviyo.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.