What's your biggest current challenge? Have your say in Community Polls along the right column.

how to display add faq section on each collection page ?

how to display add faq section on each collection page ?

innois
New Member
8 0 0

Hello,

I want to display add faq section on each collection page where admin can add faq's dynamically. 

so i have added below code. now code is working correctly i am able to add faq from backend on collection page, but same faqs data display on all collection pages. every collection page has a diffrent faq data . eg veliche page valiche faq, sparta page sparta faq.

 

 

 

<section class="sf__pages-other" data-section-id="{{ section.id }}" data-section-type="page-faqs">
  <div class="container">
    <div class="flex flex-col-reverse lg:flex-row">
      {% if section.settings.menu != blank %}
        <div class="lg:w-3/12 lg:pr-24 mt-6 lg:mt-0">
          <ul class="sf__list-row sf__list-row-border">
            {%- for link in linklists[section.settings.menu].links -%}
            <li{% if link.active %} class="active"{% endif %}><a href="{{ link.url }}"><span>{{ link.title }}</span></a></li>
            {%- endfor -%}
          </ul>
        </div>
      {% endif %}
      <div class="{% if section.settings.menu != blank %}lg:w-9/12{% else %}w-full{% endif %}">
        {% for block in section.blocks %}
          {% case block.type %}
            {% when 'content' %}
              {% if block.settings.content != blank %}
              <div class="{% if forloop.index == 1 %}mb-10{% else %}my-10{% endif %}">
                {{ block.settings.content }}
              </div>
              {% endif %}
            {% else %}
              {% if block.settings.title != blank and block.settings.content != blank and collection.all_vendors %}
              <div class="sf__accordio-blocks sf__custom-accordion">
                <div class="sf__accordion-item{% if block.settings.open %} open{% endif %}">
                  <h3 class="sf__accordion-button text-lg">{{ block.settings.title }}</h3>
                  <div class="sf__accordion-content text-base text-color-subtext">{{ block.settings.content }}</div>
                </div>
              </div>
              {% endif %}
          {% endcase %}
        {% endfor %}
      </div>
    </div>
  </div>
</section>
{% schema %}
{
    "name": "FAQ",
    "settings": [],
	  "blocks": [
    {
      "type": "content",
      "name": "Custom content",
      "settings": [
        {
          "type": "html",
          "id": "content",
          "label": "Content",
          "info": "Allow html code"
        }
      ]
    },
    {
      "type": "accordion",
      "name": "Accordion item",
      "settings": [
        {
          "type": "textarea",
          "id": "title",
          "label": "Heading",
          "default": "Question Name"
        },
        {
          "type": "richtext",
          "id": "content",
          "label": "Content",
          "default": "<p>Answer Content</p>"
        },
        {
          "type": "checkbox",
          "id": "open",
          "label": "Open Tab By Default",
          "default": false
        }
      ]
    }
  ],
    "presets": [
    {
      "name": "FAQs",
      "blocks": [
        {
          "type": "accordion"
        },
        {
          "type": "accordion"
        },
        {
          "type": "accordion"
        },
        {
          "type": "accordion"
        }
      ]
    }
  ]
}
{% endschema %}

{% stylesheet %}
{% endstylesheet %}

{% javascript %}
{% endjavascript %}

 

 

Replies 4 (4)

Dan-From-Ryviu
Shopify Partner
10301 2044 2115

Hi @innois 

I guess you need to create template for each collection to have different FAQ section. You can check this to learn how to create a new template 

https://help.shopify.com/en/manual/online-store/themes/theme-structure/templates#create-a-new-templa...

- Helpful? Like and Accept solution! Or Support me: Buy Coffees
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

David_SHT
Globetrotter
605 125 126

Hi @innois ,

 

This is David at SalesHunterThemes.

So that every collection page has a different faq data you can create a template collections:

     Create a new template collections

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme that you want to edit, and then click Customize.
  3. Use the Template drop-down menu to select a template. In Collections, Click + Create template.
  4. Give your template a unique name.
  5. Using the Template drop-down menu, select which existing template you want to base your new template on.
  6. Click Create template.

     Apply a new template collections

  1. From your Shopify admin, go to Products > Collections.
  2. Use the search filter to locate the collection that you want to change, or click the collection from the list of existing collections.
  3. In the Online store section, use the drop-down menu to select a new theme template to apply to the selected collection.
  4. Click Save.

 

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

David | SalesHunterThemes team

We create fast Shopify themes, focusing on exceptional performance and seamless experience across all devices.

Try our Electro theme Free! (Now at Black Friday price)

RockTechnolabs
Shopify Partner
251 36 60

HI, @innois Using metafields you can archive this.

banned

topnewyork
Astronaut
761 124 139

Hi @innois , kindly check out the below video:

 

If my reply is helpful, kindly click like and mark it as an accepted solution.

Thanks!

Need a Shopify developer?
Hire us at Top New York Web Design
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Try Big Bulk Discount To Boost Your Store Sales with Volume/Tier Discount