Hide empty collapsible rows in Vision theme

Solved

Hide empty collapsible rows in Vision theme

lho
Visitor
3 0 0

Hi,

I would like to hide the empty collapsible rows on product pages in the Vision theme. I have successfully done this before in the Dawn theme, but it looks like I need specific coding to do this in the Vision theme. Has anyone been able to do this in the Vision theme?

Website URL: https://ndqufiu5gdqiqm35-18910077.shopifypreview.com

Accepted Solution (1)

PageFly-Richard
Shopify Partner
4400 1006 1657

This is an accepted solution.

 

Hi @lho 

 

This is Richard from PageFly - Shopify Page Builder App

 

Please add this code to your theme.liquid above the </head> to get this solved

Step 1: Online Stores > Themes > More Actions > Edit code

Step 2: click on theme.liquid and paste the code above the </head>

<script>
const pfInterval = setInterval(() => {
  const accordions = document.querySelectorAll('.collapsible__content');
if(accordions ) {
clearInterval(pfInterval)
  accordions.forEach(accordion => {
if(accordion.childElementCount === 0 ){
    accordion.closest('collapsible-row').remove()

}
})
}

},100)
setTimeout(() => {
clearInterval(pfInterval)
},15000)
</script>

PageFlyRichard_0-1703033303048.png

 

Hope this can help you solve the issue 

 

Best regards,

Richard | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

View solution in original post

Replies 4 (4)

joehustle
Shopify Partner
31 2 4

JAVASCRIPT

(function() {
  const accordionRows = document.querySelectorAll('.product-accordion__content');
  for (const row of accordionRows) {
    if (row.children.length === 0) {
      row.parentElement.style.display = 'none';
    }
  }
})();
- If this is helpful pls Like and Accept a solution.

Click here to Whatsapp me.

PageFly-Richard
Shopify Partner
4400 1006 1657

This is an accepted solution.

 

Hi @lho 

 

This is Richard from PageFly - Shopify Page Builder App

 

Please add this code to your theme.liquid above the </head> to get this solved

Step 1: Online Stores > Themes > More Actions > Edit code

Step 2: click on theme.liquid and paste the code above the </head>

<script>
const pfInterval = setInterval(() => {
  const accordions = document.querySelectorAll('.collapsible__content');
if(accordions ) {
clearInterval(pfInterval)
  accordions.forEach(accordion => {
if(accordion.childElementCount === 0 ){
    accordion.closest('collapsible-row').remove()

}
})
}

},100)
setTimeout(() => {
clearInterval(pfInterval)
},15000)
</script>

PageFlyRichard_0-1703033303048.png

 

Hope this can help you solve the issue 

 

Best regards,

Richard | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

lho
Visitor
3 0 0

That worked perfectly! Thank you.

PageFly-Richard
Shopify Partner
4400 1006 1657

Glad that i can help. Let me know if you have any questions

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.