# Accordion block

In the Product template, the **Accordion block** lets you add multiple headings that reveal more text when clicked. It's great for answering common questions or adding further product details in a compact way.

> See also Spark's specialized accordions for [Shipping](https://help.fluorescent.co/spark/product-pages/product-page-blocks/shipping-accordion), [Payments](https://help.fluorescent.co/spark/product-pages/product-page-blocks/payment-accordion), and [Security](https://help.fluorescent.co/spark/product-pages/product-page-blocks/security-accordion) to help build trust with your customers.

![](https://1721436993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iiuvh8UrcOxEOQkY2iO%2Fuploads%2Fgit-blob-b5e5773f1e097e15656e2374b3760071a8dd0dcd%2Fproduct-accordion.jpeg?alt=media)

## **Set up accordion block**

Follow the steps to add an accordion with a heading and body text. You can choose to display accordions as closed or open when the page is first loaded.

<details>

<summary><mark style="color:blue;">STEPS</mark></summary>

In your theme editor (**Customize**):

1. Under **Product overview**, click **(+) Add block** and select **Accordion**.
2. Click on the new **Accordion** block to open the settings.
3. Select which **Column** to display the accordion: Either the **Right** (in the product form) or on the **Left** (beneath the product media).
4. Set the **Style** of the accordion to be **Open** or **Closed** when customers first visit your product page.
5. Enter text in **Heading** to display as the title.

   > We recommend a heading that explains the content in a few words.

   > To show different text on different product pages, you can [create multiple templates](https://help.fluorescent.co/spark/general/editing-themes/using-templates#create-and-assign-multiple-templates) or [use dynamic sources](https://help.fluorescent.co/spark/general/adapting-your-theme/dynamic-content-with-metafields).
6. Enter **Text** to display inside the accordion when opened.

   > Use the formatting buttons to add text styles, links, or lists. To learn more, see Shopify's [Rich text editor guide](https://help.shopify.com/en/manual/shopify-admin/productivity-tools/rich-text-editor#format-text-with-the-rich-text-editor).

   > To show different text on different product pages, you can [create multiple templates](https://help.fluorescent.co/spark/general/editing-themes/using-templates#create-and-assign-multiple-templates) or [use dynamic sources](https://help.fluorescent.co/spark/general/adapting-your-theme/dynamic-content-with-metafields).
7. (*Optional*.) Click and hold the drag handles **`⋮⋮`** to rearrange the blocks:

   ![](https://1721436993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iiuvh8UrcOxEOQkY2iO%2Fuploads%2Fgit-blob-22765d66f3708b95b5907a71e6b24326594ad146%2Fshopify-content-drag-handles.jpeg?alt=media)

   > Click **Remove block** in the block settings to delete a block.

   > Click the **Eye icon** to hide or unhide a block.
8. Click **Save**.

</details>

## **Add dynamic content for different products**

If you want to show different text for specific products, you can use Shopify's **metafields** and **dynamic sources**. These features allow you to store custom information for each of your products and automatically display that information on the correct product pages.

Follow the steps below to create metafields for your products, add text to your products' metafields, then use **Dynamic sources** to connect those metafields to text fields in your theme editor.

> For a general introduction, see our [Dynamic sources and metafields tutorial](https://help.fluorescent.co/spark/general/adapting-your-theme/dynamic-content-with-metafields).

### **1. Create metafield for products**

Shopify's **Metafields** lets you store additional information about your products. You can create custom fields to hold different types of information in your Shopify admin, and enter unique content for each of your products.

The steps below tell you how to add a metafield for storing text that you want to display in the accordion block.

<details>

<summary><mark style="color:blue;">STEPS</mark></summary>

In your theme editor (**Customize**):

1. Click on a **Accordion** block to open the settings.
2. Next to the **Heading** or **Body** field, click the **Insert dynamic source** button and select **(+) Add Metafield**.

   ![](https://1721436993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iiuvh8UrcOxEOQkY2iO%2Fuploads%2Fgit-blob-c97c51623f9a7400d398035c6b0a3fc2ffbb9475%2Fdynamic-create-metafield.jpeg?alt=media)

   Alternatively, go to **Settings > Custom data** in your **Shopify admin**.
3. Click the **Products** tab.

   ![](https://1721436993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iiuvh8UrcOxEOQkY2iO%2Fuploads%2Fgit-blob-0faa0d0960ece34cf4f568c8325e4059beada7c7%2Fmetafield-product.jpeg?alt=media)
4. Click the **Add definition** button in the top-right.
5. Enter a **Name** that describes what information the metafield will contain. For example: "Shipping", "Materials", "Details".

   ![](https://1721436993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iiuvh8UrcOxEOQkY2iO%2Fuploads%2Fgit-blob-965a222fc51d44828e681bc5411eec076b8dfaef%2Fmetafield-definition-materials.jpeg?alt=media)
6. Click **(+) Select type** button and select **Single line text** or **Multi-line text**.
7. Click **Save**.

</details>

### **2. Add content to metafields**

Once you've created **Metafields** for your products in the Shopify admin, you can now add content to those fields for your products in the Shopify admin.

<details>

<summary><mark style="color:blue;">STEPS</mark></summary>

In your **Shopify admin**:

1. Go to your **Product inventory** in your Shopify admin and open one of your **Products**.

   ![](https://1721436993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iiuvh8UrcOxEOQkY2iO%2Fuploads%2Fgit-blob-ba6779753d96402956a9813479e339a0ef63dc5d%2Fadmin-product-inventory.jpeg?alt=media)
2. Scroll down to the **Metafields** section and enter the text for your **Accordion** heading or text in the metafields that you created.

   ![](https://1721436993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iiuvh8UrcOxEOQkY2iO%2Fuploads%2Fgit-blob-2e34181509569a7235e34767e7e74bff6267edce%2Fadmin-product-metafields.jpeg?alt=media)
3. Click **Save**.
4. Repeat steps 1 - 3 to enter content to the metafields for each of your products.

</details>

### **3. Insert metafields as dynamic sources**

Now that the **Metafields** of your products have content, you can go to the theme editor to insert a **Dynamic source** to the **Accordion** block.

<details>

<summary><mark style="color:blue;">STEPS</mark></summary>

In your theme editor (**Customize**):

1. Click on a **Accordion** block to open the settings.
2. Click the **Insert dynamic source** button next to **Heading** or **Text** field.

   ![](https://github.com/fluorescent/kb-spark/blob/main/.gitbook/assets/dynamic-source-example.jpeg)
3. Select the **Metafield** that you created.
4. You can now preview your store to confirm the correct content appears when viewing different products.
5. Click **Save**.

</details>

\\

***

> **Related links**
>
> [Product template](https://help.fluorescent.co/spark/product-pages/product-template)\
> [Questions and answers section](https://help.fluorescent.co/spark/pages/theme-sections/questions-and-answers)
