How to use product tags to populate accordion panels

nashjoann
Tourist
3 0 1

Hey there!

 

I've created an accordion on my product page but want to be able to adjust the content inside one of the panels based on which tags I use. For example, I have a section called "Take me to" which I want to be populated with text saying either "take me to the beach" or "take me to the pool" based on which tags I've used (so if I use "beach" then the content inside the panel will be "take me to the beach"). Does anyone know how I can do this?  

 

Here's the HTML/liquid: 

 

 

 

<button class="accordion">
      <h2> Product Description </h2>
    </button>
      <div class="panel">
        {{ product.description }}
        
  </div>

<button class="accordion">
      <h2> Fit and Care </h2>
    </button>
      <div class="panel">
        {{ pages.fitandcare.content }}
  </div>


<button class="accordion">
      <h2> Sustainability </h2>
    </button>
      <div class="panel">
        {{ pages.sustainability.content }}
  </div>


<button class="accordion">
      <h2> Take Me To... </h2>
    </button>
      <div class="panel">
        (HERE is where I want I need to add the tag-based code)  
  </div>

 

 

0 Likes