Hello @Hund1256
To add accordion boxes for ingredients and unique sub-titles to each product in Shopify, you can follow these steps:
1.Access your Shopify theme editor: From your Shopify admin, go to “Online Store” and click on “Themes.” Then, locate the theme you’re currently using and click on “Actions” > “Edit Code.”
2.Modify the product template: In the theme editor, find the product template file where you want to add the accordion boxes and sub-titles. Typically, the file is named “product.liquid” or “product-template.liquid.”
3.Add HTML structure for accordion boxes: Within the product template file, locate the area where you want the accordion boxes to appear. You can create an HTML structure using
elements and appropriate classes to style the accordion. Here’s an example:
<div class="accordion">
<div class="accordion-item">
<h3 class="accordion-title">Ingredients</h3>
<div class="accordion-content">
{{ product.metafields.your_namespace.ingredients }}
</div>
</div>
</div>
In this example, we assume you have a metafield namespace named “your_namespace” where the ingredients data is stored.
4.Add unique sub-titles: Similarly, you can add unique sub-titles using liquid code based on metafields. Here’s an example:
<h2>{{ product.metafields.your_namespace.subtitle }}</h2>
In this example, “your_namespace” is the metafield namespace, and “subtitle” is the specific metafield for the sub-title.
5.Save and test: After making the necessary changes, save the file and preview your product pages to ensure that the accordion boxes and unique sub-titles are displayed correctly.
Remember to replace “your_namespace” with the actual namespace you have defined for your metafields, and adjust the code based on your desired styling and HTML structure.