Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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
Solved! Go to the solution
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>
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!
➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)
All features are available from Free plan. Live Chat Support is available 24/7.
JAVASCRIPT
(function() {
const accordionRows = document.querySelectorAll('.product-accordion__content');
for (const row of accordionRows) {
if (row.children.length === 0) {
row.parentElement.style.display = 'none';
}
}
})();
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>
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!
➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)
All features are available from Free plan. Live Chat Support is available 24/7.
That worked perfectly! Thank you.
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!
➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)
All features are available from Free plan. Live Chat Support is available 24/7.
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025