Shopify themes, liquid, logos, and UX
I'm trying to customize one of my sections (either a custom Liquid section or a product template section) so that it displays different content based on the product tag (Checkout). For example, if a product has the tag premium, I want to show a special message or block of HTML, but if it doesn't, it should show the default content.
I'm comfortable editing Liquid and JSON templates, but I'm not sure what the best approach is to conditionally display content based on tags within a section.
Has anyone implemented something similar? Is there a reliable way to check for a specific tag inside a section file or a block?
Solved! Go to the solution
This is an accepted solution.
You can do this directly in your section or template file like this:
{% if product.tags contains 'premium' %}
<!-- Custom content for premium products -->
<div class="premium-message">
<p>This is a premium product!</p>
</div>
{% else %}
<!-- Default content -->
<div class="default-message">
<p>Standard product description goes here.</p>
</div>
{% endif %}
If you're using product.liquid, put it in the appropriate area where content should change.
If you're using a custom section, you can wrap the whole block or a part of it in the {% if %} statement.
This is an accepted solution.
You can do this directly in your section or template file like this:
{% if product.tags contains 'premium' %}
<!-- Custom content for premium products -->
<div class="premium-message">
<p>This is a premium product!</p>
</div>
{% else %}
<!-- Default content -->
<div class="default-message">
<p>Standard product description goes here.</p>
</div>
{% endif %}
If you're using product.liquid, put it in the appropriate area where content should change.
If you're using a custom section, you can wrap the whole block or a part of it in the {% if %} statement.
Thanks Mate.
hey thank you for your response if you need more help feel free to share it do not forget to like
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025