Shopify themes, liquid, logos, and UX
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 }} -%}
<div class="announcement-slider desktop">
<div class="announcement-container">
<p class="announcement">{{ block.settings.desktop_announcement }}</p>
<p class="announcement">{{ block.settings.desktop_announcement }}</p>
</div>
</div>
<div class="announcement-slider mobile">
<div class="announcement-container">
<p class="announcement-mobile">{{ block.settings.mobile_announcement }}</p>
<p class="announcement-mobile">{{ block.settings.mobile_announcement }}</p>
</div>
</div>
{%- 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 %}
Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025