I am trying to send a notification email that a certain customer has filled out a quote request. Here’s my first attempt, and the system says ‘no errors’, however I think something is still wrong…
*quote request is not an attribute but it’s in a hidden field in the form under utm_content.couragionquoterequest. When I preview the email everything between brackets shows that it’s blank, even though the test data at the left of the email preview screen shows people who fit the criteria.
{% if customer.utm_content.couragionquoterequest %}
Hello, {{customer.first_name}} has submitted a quote request. Here is the email address: {{customer.email_identifier}}.
{% else %} {% endif %}
Appreciate any thoughts/advice!!
Thank you,
-Rose
Page 1 / 1
Hi there,
It appears that the object "couragionquoterequest" needs to be referenced correctly. Could you please give this liquid code a try and let us know if it works?
{% if customer.utm_contentt0].couragionquoterequest %}
Thank you! I updated the code, and it indicates no errors which is good -- is the preview tab still supposed to show a blank email? Everything between brackets is blank. For a test/preview is that normal? The Sample Data showing up in the side bar is also correct, it’s just not showing up in any test or in the preview screen at right...
Thanks again,
-Rose
Hey Rose,
no actually you should see the content of the email. Would you mind sharing a test profile (the attribute and it’s value) as well as the exact liquid code you used?
Hi,
See attached, the first picture is of the liquid code I’m using, the second is what I see in the preview tab.
Thank you for the help!
-Rose
Hey @rbgaylen
Taking a look at your screenshots, you might be encountering a couple of small syntax issues here.
First, your if statement will only return “true” if there is a variable defined before this block named utm_content and that variable is an object with a property named couragionquoterequest.
So all together, your code snippet should probably look like this:
{% if customer.utm_content == "couragionquoterequest" %} show content {% endif %}
Finally, if you’re not checking for a specific value and you just want to show content whenever customer.utm_content isn’t empty, it’s better to use an evaluation against the Liquid value blank. There are different reasons for this, but primarily, it’s just because you want to ensure the “truthiness” evaluation performed by your if statement is looking to see if any value exists at that attribute. (https://shopify.dev/docs/api/liquid/basics#truthy-and-falsy)
Does that all make sense? If you haven’t checked this out already, don’t forget we have some excellent learning resources at https://customer.io/learn/, including this Liquid tutorial.
Hi Jordan,
This makes sense, and thank you for the great response - I appreciate it!