We operate a custom product business with over 10^18 possible SKUs. We’re on Shopify but don’t use Shopify products due to SKU limitations. When building confirmation emails in Klaviyo we’re struggling to pull line item properties as they may be in a different order based on the type of product ordered.
If we used Shopify products, we could pull the value for the field “_image” like this:
{{item.product.properties|lookup:'_image'}}
instead this _image value may be in position 14, 20, or 25 like this:
Is there a way to query all event.extra.line_items and only return the value if it matches a specific name?
Best answer by David To
Hello @newuser,
Thanks for sharing your question with the Community!
Similar to Shopify, you can query all the values in the event.extra.line_items to allow it to return a specific name if a specific value was matched. You can typically do this with an “if” statement or your choice of a conditional statement within the templates.
For example: {% if “EXAMPLE” in event.extra.line_items %}<img src="{{ event.item.product.variant.images.0.src }}>(% endif %}
This statement would be looking into this event.extra.line_items variable and return the image provided in the event.item.product.variant.images.0.src field. You can learn more about using conditional statements within Klaviyo from the following articles:
If you need further help building out your emails and creating these custom conditional statements, feel free to checkout out our extensive network of agency partners.
Thanks for sharing your question with the Community!
Similar to Shopify, you can query all the values in the event.extra.line_items to allow it to return a specific name if a specific value was matched. You can typically do this with an “if” statement or your choice of a conditional statement within the templates.
For example: {% if “EXAMPLE” in event.extra.line_items %}<img src="{{ event.item.product.variant.images.0.src }}>(% endif %}
This statement would be looking into this event.extra.line_items variable and return the image provided in the event.item.product.variant.images.0.src field. You can learn more about using conditional statements within Klaviyo from the following articles:
If you need further help building out your emails and creating these custom conditional statements, feel free to checkout out our extensive network of agency partners.
-David
Search saves time. Contributing compounds value.
The ROI of your reply? One helpful answer can support dozens of teams, build your credibility, sharpen your own expertise over time, foster connectivity, and create good karma – because what goes around comes around. The community is what YOU make it.