{%- comment -%} MIT License · (c) 2026 Lintel · https://lintelagency.com/resources/shopify-sections {%- endcomment -%} {%- comment -%} Product tabs: up to 6 tabs of product information. Each tab shows text entered in the block, the product description, a page, or a product metafield. Tabs on desktop (ARIA tablist with arrow keys, Home and End), an accordion on mobile, or an accordion everywhere. Every tab's content is in the HTML; tabs only change which one is shown. Uses the product picked in the settings, or the product of the product template. Tabs whose source is empty for a product (no description, metafield not set) are left out. No snippets needed. {%- endcomment -%} {%- liquid assign s = section.settings assign p = s.product if p == blank assign p = product endif assign heading_tag = s.heading_tag | default: 'h2' assign uid = 'lib-ptabs-' | append: section.id assign list_label = s.heading | strip_html | strip if list_label == blank assign list_label = p.title | default: 'Product details' endif assign tabs_html = '' assign items_html = '' assign n = 0 -%} {%- for block in section.blocks -%} {%- liquid assign b = block.settings assign body = '' -%} {%- capture body -%} {%- case b.source -%} {%- when 'description' -%} {%- if p != blank -%} {{- p.description -}} {%- elsif request.design_mode -%}
The product description appears here. Pick a product in the section settings to preview it.
{%- endif -%} {%- when 'page' -%} {%- if b.page != blank -%} {{- b.page.content -}} {%- elsif request.design_mode -%}Pick a page in this tab's settings to show its content here.
{%- endif -%} {%- when 'metafield' -%} {%- liquid assign mf = blank assign key_parts = b.metafield | strip | split: '.' if p != blank and key_parts.size == 2 assign mf_namespace = key_parts.first assign mf_key = key_parts.last assign mf = p.metafields[mf_namespace][mf_key] endif -%} {%- if mf != blank -%} {%- case mf.type -%} {%- when 'multi_line_text_field' -%}{{ mf.value | escape | newline_to_br }}
{%- when 'single_line_text_field' -%}{{ mf.value | escape }}
{%- else -%} {{- mf | metafield_tag -}} {%- endcase -%} {%- elsif request.design_mode -%}The metafield {{ b.metafield | escape }} is empty or not set for this product.
{%- endif -%} {%- else -%} {{- b.content -}} {%- endcase -%} {%- endcapture -%} {%- liquid assign body_check = body | strip_html | strip assign has_media = false if body contains 'Add a tab block, or pick a product, to show content here.
{%- endif -%}Add details about the product, care or delivery here.
", "visible_if": "{{ block.settings.source == 'text' }}" }, { "type": "page", "id": "page", "label": "Page", "info": "Used when Content is set to A page, for example a shared shipping or size guide page." }, { "type": "text", "id": "metafield", "label": "Metafield", "info": "Namespace and key, for example custom.care. Text, multi-line text and rich text metafields are supported.", "default": "custom.care", "visible_if": "{{ block.settings.source == 'metafield' }}" } ] } ], "presets": [ { "name": "Lib · Product tabs", "blocks": [ { "type": "tab", "settings": { "title": "Description", "icon": "info", "source": "description" } }, { "type": "tab", "settings": { "title": "Materials and care", "icon": "droplet", "source": "metafield", "metafield": "custom.care" } }, { "type": "tab", "settings": { "title": "Shipping and returns", "icon": "truck", "source": "text", "content": "Orders ship within 2 business days in recycled packaging. Delivery takes 3 to 5 business days.
Changed your mind? Return unused pieces within 30 days for a full refund.
" } }, { "type": "tab", "settings": { "title": "Dimensions", "icon": "ruler", "source": "text", "content": "