All things Shopify and commerce
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
https://www.awakeningra.com/products/khnum?_pos=1&_psq=kh&_ss=e&_v=1.0
I want to hide the collapsible row field "material powers" when its black for a product how could I do this ?
Solved! Go to the solution
This is an accepted solution.
Instructions
1. Go to 'Online Store' -> Theme
2. In your Active Theme click on the 3 dots (...) -> Edit Code
3. In the Sections folder locate the file 'main-product.liquid' or similar.
4. Find {%- when 'collapsible_tab' -%}
5. Below the {%- when 'collapsible_tab' -%} you will see something like this
{%- when 'collapsible_tab' -%}
<div class="product__accordion accordion quick-add-hidden" {{ block.shopify_attributes }}>
<details id="Details-{{ block.id }}-{{ section.id }}">
<summary>
<div class="summary__title">
{% render 'icon-accordion', icon: block.settings.icon %}
<h2 class="h4 accordion__title inline-richtext">
{{ block.settings.heading | default: block.settings.page.title | escape }}
</h2>
</div>
{% render 'icon-caret' %}
</summary>
<div class="accordion__content rte" id="ProductAccordion-{{ block.id }}-{{ section.id }}">
{{ block.settings.content }}
{{ block.settings.page.content }}
</div>
</details>
</div>
6. Surround everything in an if statement like this:
{%- when 'collapsible_tab' -%}
{% if block.settings.content != blank or block.settings.page.content != blank %}
<div class="product__accordion accordion quick-add-hidden" {{ block.shopify_attributes }}>
<details id="Details-{{ block.id }}-{{ section.id }}">
<summary>
<div class="summary__title">
{% render 'icon-accordion', icon: block.settings.icon %}
<h2 class="h4 accordion__title inline-richtext">
{{ block.settings.heading | default: block.settings.page.title | escape }}
</h2>
</div>
{% render 'icon-caret' %}
</summary>
<div class="accordion__content rte" id="ProductAccordion-{{ block.id }}-{{ section.id }}">
{{ block.settings.content }}
{{ block.settings.page.content }}
</div>
</details>
</div>
{% endif %}
This should work
@tarekanani Does every product on your site not have this field?
SIMICART: Mobile App Builder |Ironwork Theme - Coming Soon | Product Labels by BSS
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
some of them has it and some doesn't contain any info for this one
@tarekanani Can you show me a product that has that part?
SIMICART: Mobile App Builder |Ironwork Theme - Coming Soon | Product Labels by BSS
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
this product has no info for this metafield
Previous Question Asked and Solved
does this work with any theme ? and I have a multi-word metafield "material powers" How could I contain this to the code ?
This is an accepted solution.
Instructions
1. Go to 'Online Store' -> Theme
2. In your Active Theme click on the 3 dots (...) -> Edit Code
3. In the Sections folder locate the file 'main-product.liquid' or similar.
4. Find {%- when 'collapsible_tab' -%}
5. Below the {%- when 'collapsible_tab' -%} you will see something like this
{%- when 'collapsible_tab' -%}
<div class="product__accordion accordion quick-add-hidden" {{ block.shopify_attributes }}>
<details id="Details-{{ block.id }}-{{ section.id }}">
<summary>
<div class="summary__title">
{% render 'icon-accordion', icon: block.settings.icon %}
<h2 class="h4 accordion__title inline-richtext">
{{ block.settings.heading | default: block.settings.page.title | escape }}
</h2>
</div>
{% render 'icon-caret' %}
</summary>
<div class="accordion__content rte" id="ProductAccordion-{{ block.id }}-{{ section.id }}">
{{ block.settings.content }}
{{ block.settings.page.content }}
</div>
</details>
</div>
6. Surround everything in an if statement like this:
{%- when 'collapsible_tab' -%}
{% if block.settings.content != blank or block.settings.page.content != blank %}
<div class="product__accordion accordion quick-add-hidden" {{ block.shopify_attributes }}>
<details id="Details-{{ block.id }}-{{ section.id }}">
<summary>
<div class="summary__title">
{% render 'icon-accordion', icon: block.settings.icon %}
<h2 class="h4 accordion__title inline-richtext">
{{ block.settings.heading | default: block.settings.page.title | escape }}
</h2>
</div>
{% render 'icon-caret' %}
</summary>
<div class="accordion__content rte" id="ProductAccordion-{{ block.id }}-{{ section.id }}">
{{ block.settings.content }}
{{ block.settings.page.content }}
</div>
</details>
</div>
{% endif %}
This should work
thanks this worked !
@WalkYourStyle I've tried this and I'm getting this errors, ideas? I added the following only, did I miss something or place in the wrong place?
{% if block.settings.content != blank or block.settings.page.content != blank %}
You forgot to close the if statement like this : {% endif %} at the end
Thank you!