elena14
4 months agoPractitioner
Loop through a catalog to display the product a user has as a custom attribute
Hello,
So I am trying to display some Liquid logic into an email template. The idea is that I have a catalog named house_properties with fields: id, name and description.
Each user has a custom attribute called user_product_id which we should use in the Liquid code to display the name of the product from the catalog if the two id's are the same.
This is the Liquid code I have been using, but apparently is not working. Can someone please let me know what am I missing here?
{% assign user_product_id = {{ custom_attribute.${user_product_id} }} %}
<!-- Loop through each row in the catalog -->
{% for row in house_properties %}
<!-- Loop through each item in the current row -->
{% for item in row %}
<!-- Check if the item name contains the user's custom attribute -->
{% if item.id == {{ custom_attribute.${user_product_id} }} %}
{{ item.name }}
{% endif %}
{% endfor %}
{% endfor %}
Thank you in advance!
Elena