All things Shopify and commerce
Does anyone know how to add an accordion to the beyond theme
This is Noah from PageFly - Shopify Page Builder App
Hi @HIEa Please check again editor page. You can drag and drop accordion elements. If your theme does not support this function, please drag the html/liquid element to the position you want and add this code into the html/liquid tag.
<style>
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
.active, .accordion:hover {
background-color: #ccc;
}
.panel {
padding: 0 18px;
display: none;
background-color: white;
overflow: hidden;
}
</style>
</head>
<body>
<h2>Accordion</h2>
<button class="accordion">Section 1</button>
<div class="panel">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<button class="accordion">Section 2</button>
<div class="panel">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<button class="accordion">Section 3</button>
<div class="panel">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<script>
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.display === "block") {
panel.style.display = "none";
} else {
panel.style.display = "block";
}
});
}
</script>
Hope my solution will help you resolve the issue.
Best regards,
Noah | 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.
Hi Noah,
If I am to use this code, could you please direct me where I would go?
Hello @HIEa ,
I understand you are looking to add accordion in product pages.
In case you are not looking to add custom code for accordion, then you can go for the collapsible rows as the look and feel will be the same. https://prnt.sc/2UiEPIKm5kYg
Steps to add collapsible row -:
1. Go to Online Store-> Themes -> Click Customize.
2. Select Product Page -> Add Section -> Add Collapsible Rows https://prnt.sc/Hvw5XyxZt_y2
3. Once Collapsible rows added https://prnt.sc/5q9V99Il50vf , you can add or edit the rows heading and sub-text by clicking over it https://prnt.sc/5Tgq1x7uxCzJ
I hope it helps
Please share if you have any queries.
Thank you.
Thank you this is very helpful. I have so many different products, is there a way of adding the information under the accordions on the product pages? At the moment this has gone across all products, but I dont know how to customise each products information?
Hello @HIEa ,
I understand you are providing different headings or sub-text to different products and it may be difficult to do this without using custom coding.
You can hire a Shopify Developer who can create accordions to your specific needs or you can use a Shopify App.
Some of the Shopify Apps for your reference -:
- https://apps.shopify.com/tabs-by-station
- https://apps.shopify.com/free-tabs-custom-product-tabs
- https://apps.shopify.com/custom-product-accordion-tabs
Kindly take a look.
I hope the app helps you.
Thank you.
Shopify and our financial partners regularly review and update verification requiremen...
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