Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello, I created several collapsible rows because each one can not exceed 50kb and I have a lot of text because I have a lot of products and variants. To be sure each product has its own content, and not the same for all the products because each product is unique, I modified the code. Indeed, I wrote this in each collapsible-row (look below). But, even if a variant title isn't written in the collapsible row, the collapsible row appears. It is empty, but it appears and I don't want that because I have two collapsible rows that have the same name 'Bienfaits de la pierre' and I just want one. How can I do ? (There is no duplicate content in any of the collapsible rows and I think the code is good.). Here is a link to a picture of my problem https://docs.google.com/spreadsheets/d/1zGkTOY0wcV0W8rff9AriXYp1RNvfCq_Bz1lKLdNbhMM/edit?usp=sharing
Here is my code in the collapsible-row :
{% if product.title == 'xxx' %}
{% assign variant = product.selected_or_first_available_variant %}
{% if variant.title == 'xxx' %}
<p>xxx</p>
{% elsif variant.title == 'xxx' %}
<p>xxx</p>
{% elsif product.title == 'xxx' %}
{% assign variant = product.selected_or_first_available_variant %}
{% if variant.title == 'xxx' %}
{% elsif variant.title == 'xxx' %}
<p>xxx</p>
{% endif %}
{% endif %}
Hi @Leachapuis 👋
Hello, I created several collapsible rows because each one can not exceed 50kb
Making content live inside a theme is to be avoided.
Use metafields or metaobjects, or in some case pages content, or liquid snippets.
Or for some sections/blocks/settings use dynamic sources, no if/else logic needed
@Leachapuis wrote:even if a variant title isn't written in the collapsible row, the collapsible row appears. It is empty, but it appears a
That requires an advanced theme customization to check if the content is blank or not and allow/disallow the collapsible UI from rendering.
crudely it's a matter of wrapping the entire logic in a condition: {% if variable != blank %}.... {% endif %}
If you need that customization then contact me for services,
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
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