Collapsible row content

Collapsible row content

Leachapuis
Tourist
9 0 1

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 %}

Reply 1 (1)

PaulNewton
Shopify Partner
7746 679 1613

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

https://help.shopify.com/en/manual/online-store/themes/theme-structure/sections-and-blocks#metafield... 

 


@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