So my actual goal is to have my announcement bar have different contents depending on the product vendor of the product. My block have a text input area wherein I would like to input the brand I want the announcement is for. For some reason, it’s not working so I think I might be doing something wrong. Hope someone can point me in the right direction.
Here’s the code:
{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when 'promo_announcement' -%}
{%- if product.vendor == {{ block.settings.brand }} -%}
{{ block.settings.desktop_announcement }}
{{ block.settings.desktop_announcement }}
{{ block.settings.mobile_announcement }}
{{ block.settings.mobile_announcement }}
{%- endif -%}
{%- endcase -%}
{%- endfor -%}
{% schema %}
{
"name": "Promo Announcement",
"settings": [],
"blocks": [
{
"name": "Promo Announcement",
"type": "promo_announcement",
"settings": [
{
"type": "text",
"id": "brand",
"default": "Brand",
"label": "Heading"
}, {
"type": "inline_richtext",
"id": "desktop_announcement",
"label": "Desktop Announcement"
}, {
"type": "inline_richtext",
"id": "mobile_announcement",
"label": "Mobile Announcement"
}
]
}
],
"presets": [
{
"name": "Promo Announcement Bar"
}
]
}
{% endschema %}