Skip to main content
Problem Solver I
September 1, 2023
Solved

Edit {{ event.URL }}

  • September 1, 2023
  • 13 replies
  • 2823 views

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 }}

    Best answer by rreno

    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' }}

     

    13 replies

    rrenoAuthor
    Problem Solver I
    June 20, 2024

    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.

    Contributor I
    October 14, 2025

    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' }}

    Hi,

    I’m trying this code template but it sends an error during preview (and the code is not applied):
    “Message displayed without tags or variables.
    Fix invalid template tags or variables to preview the message with actual profiles and events.”

    The problem is on the cut function (if I remove it, the alert disappears).

    Anybody with the same problem (or with the solution)? :)

    Thanks

    Byrne C
    Community Manager
    Community Manager
    October 15, 2025

    Hey ​@MatteoP,

    Can you check and see if you’re using curly quotes instead of straight quotes around the website in the cut filter? Using curly quotes instead of straight quotes will cause variables to not render correctly.

    Additionally, you can test the URL out by manually recreating it. Manually type in https://www.YOURWEBSITE.com/discount/YOURDISCOUNT?redirect= into your browser, and replace YOURWEBISTE and YOURDISCOUNT with your website name and the coupon. Manually add in the event.url afterwards, ensuring you leave out https://www.YOURWEBSITE.comYou can find the event.url in the event data for the event triggering the flow when you press Preview & test. 

    After manually recreating the website and pressing enter in the searchbar, are you taken to a real page? If not, then the issue lies with how your website structures URLs. If not, then it might be worth reaching out to our support team at Klaviyo.com/support, so we can take a deeper look!