How to fix Klaviyo order confirmation email liquid syntax error?

I’ve created an order confirmation email within klaviyo and just exported the code to put it into the relevant shopify notification. I am receiving the following error notice back - “Body html Liquid syntax error: ‘endfor’ is not a valid delimiter for if tags. use endif”.

If anyone can help me fix this I would be most appreciative :slightly_smiling_face:

@media only screen and (max-width:480px){body,table,td,p,a,li,blockquote{-webkit-text-size-adjust:none !important}body{width:100% !important;min-width:100% !important}#bodyCell{padding:10px !important}table.kmMobileHide{display:none !important}table.kmDesktopOnly,td.kmDesktopOnly,th.kmDesktopOnly,tr.kmDesktopOnly,td.kmDesktopWrapHeaderMobileNone{display:none !important}table.kmMobileOnly{display:table !important}tr.kmMobileOnly{display:table-row !important}td.kmMobileOnly,td.kmDesktopWrapHeader,th.kmMobileOnly{display:table-cell !important}tr.kmMobileNoAlign,table.kmMobileNoAlign{float:none !important;text-align:initial !important;vertical-align:middle !important;table-layout:fixed !important}tr.kmMobileCenterAlign{float:none !important;text-align:center !important;vertical-align:middle !important;table-layout:fixed !important}td.kmButtonCollection{padding-left:9px !important;padding-right:9px !important;padding-top:9px !important;padding-bottom:9px !important}td.kmMobileHeaderStackDesktopNone,img.kmMobileHeaderStackDesktopNone,td.kmMobileHeaderStack{display:block !important;margin-left:auto !important;margin-right:auto !important;padding-bottom:9px !important;padding-right:0 !important;padding-left:0 !important}td.kmMobileWrapHeader,td.kmMobileWrapHeaderDesktopNone{display:inline-block !important}td.kmMobileHeaderSpacing{padding-right:10px !important}td.kmMobileHeaderNoSpacing{padding-right:0 !important}table.kmDesktopAutoWidth{width:inherit !important}table.kmMobileAutoWidth{width:100% !important}table.kmTextContentContainer{width:100% !important}table.kmBoxedTextContentContainer{width:100% !important}td.kmImageContent{padding-left:0 !important;padding-right:0 !important}img.kmImage{width:100% !important}td.kmMobileStretch{padding-left:0 !important;padding-right:0 !important}table.kmSplitContentLeftContentContainer,table.kmSplitContentRightContentContainer,table.kmColumnContainer,td.kmVerticalButtonBarContentOuter table.kmButtonBarContent,td.kmVerticalButtonCollectionContentOuter table.kmButtonCollectionContent,table.kmVerticalButton,table.kmVerticalButtonContent{width:100% !important}td.kmButtonCollectionInner{padding-left:9px !important;padding-right:9px !important;padding-top:9px !important;padding-bottom:9px !important}td.kmVerticalButtonIconContent,td.kmVerticalButtonTextContent,td.kmVerticalButtonContentOuter{padding-left:0 !important;padding-right:0 !important;padding-bottom:9px !important}table.kmSplitContentLeftContentContainer td.kmTextContent,table.kmSplitContentRightContentContainer td.kmTextContent,table.kmColumnContainer td.kmTextContent,table.kmSplitContentLeftContentContainer td.kmImageContent,table.kmSplitContentRightContentContainer td.kmImageContent{padding-top:9px !important}td.rowContainer.kmFloatLeft,td.rowContainer.kmFloatLeft,td.rowContainer.kmFloatLeft.firstColumn,td.rowContainer.kmFloatLeft.firstColumn,td.rowContainer.kmFloatLeft.lastColumn,td.rowContainer.kmFloatLeft.lastColumn{float:left;clear:both;width:100% !important}table.templateContainer,table.templateContainer.brandingContainer,div.templateContainer,div.templateContainer.brandingContainer,table.templateRow{max-width:600px !important;width:100% !important}h1{font-size:40px !important;line-height:1.1 !important}h2{font-size:32px !important;line-height:1.1 !important}h3{font-size:24px !important;line-height:1.1 !important}h4{font-size:18px !important;line-height:1.1 !important}td.kmTextContent{font-size:14px !important;line-height:1.3 !important}td.kmTextBlockInner td.kmTextContent{padding-right:18px !important;padding-left:18px !important}table.kmTableBlock.kmTableMobile td.kmTableBlockInner{padding-left:9px !important;padding-right:9px !important}table.kmTableBlock.kmTableMobile td.kmTableBlockInner .kmTextContent{font-size:14px !important;line-height:1.3 !important;padding-left:4px !important;padding-right:4px !important}} span.yshortcuts:hover {background-color:none !important;border:none !important} span.yshortcuts:active {background-color:none !important;border:none !important} span.yshortcuts:focus {background-color:none !important;border:none !important} .rowContainer .kmTextContent a:link {color:#000;font-weight:normal;text-decoration:underline} .rowContainer .kmTextContent a:visited {color:#000;font-weight:normal;text-decoration:underline} .kmTable .kmTableRow:last-child > td {border-bottom:none !important}#outlook a { padding-left: 0; padding-right: 0; padding-top: 0; padding-bottom: 0 } .ReadMsgBody { width: 100% } .ExternalClass { width: 100% } span.yshortcuts { background-color: none !important; border: none !important } span.yshortcuts:hover, span.yshortcuts:active, span.yshortcuts:focus { background-color: none !important; border: none !important } body { margin: 0; padding: 0 } a { word-wrap: break-word !important; max-width: 100% } img { border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none; max-width: 100% } img[align="left"] { margin-right: 0 } img[align="right"] { margin-left: 0 } table, td { border-collapse: collapse; mso-table-lspace: 0; mso-table-rspace: 0; table-layout: fixed } p { margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; padding-bottom: 1em } p:last-child { padding-bottom: 0 } #bodyTable, #bodyCell { height: 100% !important; margin: 0; width: 100% !important; table-layout: auto } #bodyTable { padding: 0 } #bodyCell { padding-top: 50px; padding-left: 20px; padding-bottom: 20px; padding-right: 20px; border-top: 0 } body, #bodyTable { background-color: #F7F7F7 } .templateContainer { border: 0 none #aaa; background-color: #fff; border-radius: 0 } .brandingContainer { background-color: transparent; border: 0 } .templateContainerInner { padding: 0 } h1 { color: #222 !important; display: block; font-family: "Trebuchet MS"; font-size: 40px; font-style: normal; font-weight: normal; line-height: 1.1; letter-spacing: 0; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 20px; text-align: left } h2 { color: #222 !important; display: block; font-family: "Trebuchet MS"; font-size: 32px; font-style: normal; font-weight: bold; line-height: 1.1; letter-spacing: 0; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 16px; text-align: left } h3 { color: #222 !important; display: block; font-family: "Trebuchet MS"; font-size: 24px; font-style: normal; font-weight: bold; line-height: 1.1; letter-spacing: 0; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 12px; text-align: left } h4 { color: #222 !important; display: block; font-family: "Trebuchet MS"; font-size: 18px; font-style: normal; font-weight: italic; line-height: 1.1; letter-spacing: 0; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 9px; text-align: left } .rowContainer .kmTextContent { color: #222; font-family: "Trebuchet MS"; font-size: 14px; line-height: 1.3; letter-spacing: 0; text-align: left; max-width: 100%; word-wrap: break-word } .rowContainer .kmTextContent a, .rowContainer .kmTextContent a:link, .rowContainer .kmTextContent a:visited, .rowContainer .kmTextContent a .yshortcuts { color: #000; font-weight: normal; text-decoration: underline } .rowContainer .kmTextContent .kmParagraph { padding-bottom: 9px } .kmImageContent { padding: 0; font-size: 0 } .kmImage { padding-bottom: 0; display: inline !important; vertical-align: top; border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none; font-size: 12px; width: 100% } .kmButtonBlockInner, .kmButtonCollectionInner { min-width: 60px; padding: 9px 18px } .kmButtonContentContainer { border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; background-color: #999; border-collapse: separate } .kmButtonContent { color: white; font-family: "Trebuchet MS"; font-size: 16px } .kmButton { font-weight: bold; line-height: 100%; text-align: center; text-decoration: none; color: white; font-family: "Trebuchet MS"; font-size: 16px } .kmButtonBarContent, .kmButtonCollectionContent { font-family: "Trebuchet MS" } .kmVerticalButtonContent { border-collapse: separate } .kmTable .kmTableRow > td:last-child { border-right: none !important } .kmTable .kmTableRow:last-child > td { border-bottom: none !important } .kmMobileOnly { display: none } .kmDesktopWrapHeader, .kmDesktopWrapHeaderMobileNone { display: inline-block } .kmHide { display: none } .kmMobileHeaderStackDesktopNone, .kmMobileWrapHeaderDesktopNone { display: none } .kmDesktopAutoWidth { width: 100% }

Hey {{ first_name|default:'' }}, this email is to confirm your order on {{ date | date: "%m/%d/%Y" }}. Your order number is {{ order_number }}.

Billing Address:

{{ billing_address.name }}
{{ billing_address.street }}
{{ billing_address.city }}, {{ billing_address.province }} {{ billing_address.zip }}
{{ billing_address.country }}

{% if requires_shipping %}

Shipping Address:

{{ shipping_address.name }}
{{ shipping_address.street }}
{{ shipping_address.city }}, {{ shipping_address.province }} {{ shipping_address.zip }}
{{ shipping_address.country }}

{% endif %}

Order Details:

{% if line_items %} {% for line in line_items %} {% endfor %}
line.title

{{ line.title }}

Quantity: {{ line.quantity }}
Total: {{ line.price|money }}

{% if discounts %}Discount (code: {{ discounts.first.code }}): {{ discounts_savings|money }}
{% endif %} Subtotal: {{ subtotal_price|money }}
{% endfor %} {% if requires_shipping %} Shipping: {{ shipping_price|money }}
{% endif %} Total: {{ total_price|money }}

{% else %}
{% endif %}
Follow
Follow
Follow
{{ shop_name }}

Hey {{ first_name|default:‘’ }}, this email is to confirm your order on {{ date | date: “%m/%d/%Y” }}. Your order number is {{ order_number }}.

Billing Address:

{{ billing_address.name }}
{{ billing_address.street }}
{{ billing_address.city }}, {{ billing_address.province }} {{ billing_address.zip }}
{{ billing_address.country }}

{% if requires_shipping %}#### Shipping Address:

{{ shipping_address.name }}
{{ shipping_address.street }}
{{ shipping_address.city }}, {{ shipping_address.province }} {{ shipping_address.zip }}
{{ shipping_address.country }}

{% endif %}

Order Details:

{% if line_items %}{% for line in line_items %}{% endfor %}
### {{ line.title }}

Quantity: {{ line.quantity }}
Total: {{ line.price|money }}

{% if discounts %}Discount (code: {{ discounts.first.code }}): {{ discounts_savings|money }}
{% endif %} Subtotal: {{ subtotal_price|money }}
{% endfor %} {% if requires_shipping %} Shipping: {{ shipping_price|money }}
{% endif %} Total: {{ total_price|money }}

{% else %}
{% endif %}


Follow


Follow


Follow

{{ shop_name }}


Powered by Klaviyo

Hello @indiandoscar !

When it comes to third party apps such as Klaviyo and their code, our own support team is not able to look into it for you directly, however I can recommend that you get in touch with the developers of the app, as they know their own code best and will likely be able to shed some light on this issue for you.

I had a look, and I found their support email address and phone number - (617) 415-5563, as well as the link to their developer website. All of these support options are on their app listing on our Shopify App Store, so feel free to contact them directly and you can even link this forum thread for them as you outline the issue very clearly here.

Just in case you’re unable to solve your Klaviyo issue, would you be open to look into other email marketing services? We have a great built in service for this called Shopify Emails, and if you’re interested I have all of the info on it in this help doc here. An advantage to using Shopify Emails is that in case something goes wrong, we would be able to look into it for you since it is directly supported by us.