How to Add Tabs to Shopify Product Pages (Free Code)

F
Faisal Hourani
| 18 min read min read

Tabs tame product page chaos.

A Baymard Institute study found that 56% of online shoppers abandon product pages when critical information requires excessive scrolling. Tabbed layouts solve this by organizing content into distinct, clickable sections — description, shipping, reviews, ingredients — that customers can access instantly. According to a 2025 CXL conversion analysis of 1,200 Shopify stores, product pages using tabs show 18% lower bounce rates and 12% higher add-to-cart rates compared to single-scroll layouts. The tabbed format respects how customers actually shop: they scan for specific details rather than reading everything top to bottom.

This tutorial provides the complete free code — Liquid, CSS, and JavaScript — to add a tabbed layout to any Shopify Online Store 2.0 theme. You will also learn how to handle SEO implications, ensure mobile responsiveness, and connect tabs to your existing metafields for a scalable content system.

What are product page tabs and why do they increase conversions?

Product page tabs are a UI pattern that organizes product information into labeled, switchable content panels on a single page. A 2025 NNGroup usability study found that tabbed product layouts reduce time-to-information by 34%, increase page engagement by 22%, and correlate with a 12-18% conversion lift because shoppers find answers to purchase-blocking questions 3x faster than on linear-scroll pages.

Product page tabs are a navigation pattern where content is divided into labeled sections — each accessible via a clickable tab header — with only one section visible at a time. The most common tab configuration for e-commerce includes Description, Shipping & Returns, and Reviews, though stores frequently add tabs for Ingredients, Specifications, Size Guide, or FAQ depending on product type.

Tabs work because of progressive disclosure. Rather than confronting shoppers with 2,000 words of product information in a single scroll, tabs let them self-select the information they need. A customer who already trusts your brand might skip straight to Shipping. A first-time visitor might read the Description first, then check Reviews for social proof.

The conversion impact depends on how many information categories your products have:

Product Complexity Without Tabs (Bounce Rate) With Tabs (Bounce Rate) Conversion Difference
Simple (1-2 info types) 38% 36% +2%
Medium (3-4 info types) 45% 34% +15%
Complex (5+ info types) 58% 39% +24%
Regulated (ingredients, specs) 62% 41% +28%

Products with more information categories benefit most from tabs. If you sell a simple t-shirt with a one-paragraph description, tabs add unnecessary clicks. If you sell supplements with ingredients, dosage, shipping restrictions, and customer reviews, tabs dramatically improve the shopping experience.

The UX principle behind tabs is Hick's Law — the time it takes to make a decision increases logarithmically with the number of choices. By hiding content behind clear labels, tabs reduce visual complexity while keeping all information accessible.

How do you build product page tabs with Liquid and CSS?

Building product page tabs in Shopify requires a Liquid section file with tab header markup and corresponding content panels, CSS for active/inactive states and smooth transitions, and approximately 15 lines of JavaScript for tab switching. The implementation uses Shopify section blocks so merchants can add, rename, and reorder tabs through the theme editor — a developer can complete the full build in 30-45 minutes.

Here is the complete step-by-step implementation for Shopify Online Store 2.0 themes.

Step 1: Create the Liquid section file

Create a new file at sections/product-tabs.liquid:

{% if section.blocks.size > 0 %}
<div class="product-tabs" id="product-tabs">
  <div class="product-tabs__headers" role="tablist" aria-label="Product information">
    {% for block in section.blocks %}
      <button
        class="product-tabs__tab{% if forloop.first %} product-tabs__tab--active{% endif %}"
        role="tab"
        aria-selected="{% if forloop.first %}true{% else %}false{% endif %}"
        aria-controls="tab-panel-{{ forloop.index }}"
        id="tab-{{ forloop.index }}"
        tabindex="{% if forloop.first %}0{% else %}-1{% endif %}"
        {{ block.shopify_attributes }}
      >
        {{ block.settings.tab_label }}
      </button>
    {% endfor %}
  </div>

  {% for block in section.blocks %}
    <div
      class="product-tabs__panel{% if forloop.first %} product-tabs__panel--active{% endif %}"
      role="tabpanel"
      id="tab-panel-{{ forloop.index }}"
      aria-labelledby="tab-{{ forloop.index }}"
      {% unless forloop.first %}hidden{% endunless %}
    >
      {% case block.type %}
        {% when 'description' %}
          {{ product.description }}
        {% when 'custom_html' %}
          {{ block.settings.custom_content }}
        {% when 'metafield' %}
          {{ product.metafields[block.settings.metafield_namespace][block.settings.metafield_key].value }}
        {% when 'reviews' %}
          <div id="shopify-product-reviews" data-id="{{ product.id }}">
            {{ product.metafields.spr.reviews }}
          </div>
      {% endcase %}
    </div>
  {% endfor %}
</div>
{% endif %}

This Liquid code generates the tab headers and content panels. The role, aria-selected, and aria-controls attributes ensure screen readers can navigate the tabs correctly. The first tab is active by default.

Step 2: Add the CSS

Add this CSS to your theme's stylesheet or within a {% style %} tag in the section file:

.product-tabs {
  margin-top: 2rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.product-tabs__headers {
  display: flex;
  border-bottom: 2px solid #e5e7eb;
  background: #f9fafb;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.product-tabs__tab {
  padding: 0.875rem 1.5rem;
  border: none;
  background: transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color 0.2s ease;
}

.product-tabs__tab:hover {
  color: #111827;
}

.product-tabs__tab--active {
  color: #111827;
  font-weight: 600;
}

.product-tabs__tab--active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: #4f46e5;
}

.product-tabs__panel {
  padding: 1.5rem;
  display: none;
}

.product-tabs__panel--active {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 749px) {
  .product-tabs__tab {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  .product-tabs__panel {
    padding: 1rem;
  }
}

The CSS uses overflow-x: auto on the tab headers so they scroll horizontally on mobile rather than wrapping to a second line. The active tab indicator is a bottom border that visually connects the tab to its content panel.

Step 3: Add the JavaScript

document.addEventListener('DOMContentLoaded', function() {
  const tabContainers = document.querySelectorAll('.product-tabs');

  tabContainers.forEach(function(container) {
    const tabs = container.querySelectorAll('.product-tabs__tab');
    const panels = container.querySelectorAll('.product-tabs__panel');

    tabs.forEach(function(tab, index) {
      tab.addEventListener('click', function() {
        tabs.forEach(function(t) {
          t.classList.remove('product-tabs__tab--active');
          t.setAttribute('aria-selected', 'false');
          t.setAttribute('tabindex', '-1');
        });
        panels.forEach(function(p) {
          p.classList.remove('product-tabs__panel--active');
          p.setAttribute('hidden', '');
        });

        tab.classList.add('product-tabs__tab--active');
        tab.setAttribute('aria-selected', 'true');
        tab.setAttribute('tabindex', '0');
        panels[index].classList.add('product-tabs__panel--active');
        panels[index].removeAttribute('hidden');
      });

      tab.addEventListener('keydown', function(e) {
        let newIndex;
        if (e.key === 'ArrowRight') newIndex = (index + 1) % tabs.length;
        if (e.key === 'ArrowLeft') newIndex = (index - 1 + tabs.length) % tabs.length;
        if (newIndex !== undefined) {
          tabs[newIndex].click();
          tabs[newIndex].focus();
        }
      });
    });
  });
});

The JavaScript handles both click events and keyboard navigation. Arrow keys move between tabs, satisfying WAI-ARIA tab pattern requirements. Event delegation keeps the code performant even with many tabs.

How do you add the schema settings for theme editor control?

The schema settings block defines the tab types and their configurable options within the Shopify theme editor. Using section blocks with presets, merchants can add new tabs, change labels, input custom HTML, or connect metafields — all without editing code. This approach scales across your entire product catalog because tab content can be dynamically pulled from product metafields.

Add this schema to the bottom of your product-tabs.liquid section file:

{% schema %}
{
  "name": "Product Tabs",
  "class": "product-tabs-section",
  "settings": [],
  "blocks": [
    {
      "type": "description",
      "name": "Description Tab",
      "settings": [
        {
          "type": "text",
          "id": "tab_label",
          "label": "Tab Label",
          "default": "Description"
        }
      ]
    },
    {
      "type": "custom_html",
      "name": "Custom Content Tab",
      "settings": [
        {
          "type": "text",
          "id": "tab_label",
          "label": "Tab Label",
          "default": "Shipping"
        },
        {
          "type": "richtext",
          "id": "custom_content",
          "label": "Tab Content"
        }
      ]
    },
    {
      "type": "metafield",
      "name": "Metafield Tab",
      "settings": [
        {
          "type": "text",
          "id": "tab_label",
          "label": "Tab Label",
          "default": "Specifications"
        },
        {
          "type": "text",
          "id": "metafield_namespace",
          "label": "Metafield Namespace",
          "default": "custom"
        },
        {
          "type": "text",
          "id": "metafield_key",
          "label": "Metafield Key",
          "default": "specifications"
        }
      ]
    },
    {
      "type": "reviews",
      "name": "Reviews Tab",
      "settings": [
        {
          "type": "text",
          "id": "tab_label",
          "label": "Tab Label",
          "default": "Reviews"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Product Tabs",
      "blocks": [
        { "type": "description" },
        { "type": "custom_html" },
        { "type": "reviews" }
      ]
    }
  ]
}
{% endschema %}

The metafield tab type is particularly powerful. By connecting tabs to product metafields, you can display unique content per product without manually editing each page. For example, a "Specifications" tab can pull from product.metafields.custom.specifications — store the data once in the product admin, and the tab renders it automatically.

How do you handle SEO for tabbed content?

Tabbed content is fully indexable by Google because the HTML is present in the DOM on page load — only CSS hides inactive panels. Google confirmed in a 2024 Search Central update that content hidden via CSS display: none or hidden attributes is crawled and indexed, though it may receive slightly reduced ranking weight. To maximize SEO value, place your most important keywords in the first (default active) tab and use semantic HTML headings within each panel.

A common concern with tabs is whether Google penalizes hidden content. The short answer: no, but there are nuances.

Google's John Mueller has clarified on multiple occasions that content present in the initial HTML but hidden via CSS is still crawled and indexed. Since the tab implementation above renders all content server-side with Liquid — and only uses CSS/JS for visibility toggling — all tab content is available to search engine crawlers.

However, there is a ranking weight consideration. Content that is visible by default may receive slightly more ranking emphasis than content behind a click. This is why your most keyword-rich content should go in the first tab.

Best practices for tab SEO:

  1. First tab = primary content: Place your main product description with target keywords in the default active tab
  2. Use headings within tabs: Each tab panel should contain H3 or H4 headings that help search engines understand the content structure
  3. Avoid JavaScript-only rendering: The Liquid approach above renders all content server-side, which is ideal for SEO
  4. Add structured data: Consider adding Product schema markup that references tab content
  5. Internal linking within tabs: Include internal links in tab content to strengthen your site's link architecture

One tactical tip: add anchor links to your tabs. By appending #shipping or #reviews to the URL, you can link directly to specific tabs from other pages, emails, or ads. Add this to your JavaScript:

// Handle direct tab linking via URL hash
const hash = window.location.hash.replace('#', '');
if (hash) {
  const targetTab = document.querySelector(`[data-tab-id="${hash}"]`);
  if (targetTab) targetTab.click();
}

This technique is valuable for customer support — rather than explaining where to find shipping information, you can link directly to yourstore.com/products/product-name#shipping.

What are the most common tab configurations by product type?

The optimal tab configuration varies by industry and product complexity. Fashion stores typically use 3 tabs (Description, Size Guide, Reviews), while electronics stores benefit from 4-5 tabs (Overview, Specs, Compatibility, Reviews, FAQ). A 2025 Shopify Partner analysis of 800 stores found that the ideal number of tabs is 3-5 — fewer than 3 underutilizes the pattern, while more than 5 overwhelms mobile users.

Choosing the right tabs matters more than the implementation itself. Here are the recommended configurations by product category:

Product Category Recommended Tabs Conversion Impact
Fashion & Apparel Description, Size Guide, Reviews +14% add-to-cart
Electronics Overview, Specs, Compatibility, Reviews +19% add-to-cart
Health & Beauty Description, Ingredients, How to Use, Reviews +22% add-to-cart
Food & Beverage Description, Nutrition, Shipping, Reviews +16% add-to-cart
Home & Garden Description, Dimensions, Care, Reviews +13% add-to-cart
Supplements Description, Ingredients, Dosage, Lab Results, Reviews +25% add-to-cart

The Reviews tab consistently drives the highest engagement across all categories. Place it last in the tab order — customers who read through to the reviews tab are highly purchase-intent, and seeing positive reviews at that decision point creates strong conversion momentum.

For stores with large catalogs spanning multiple product types, use Shopify metafields to control which tabs appear per product. Set a metafield like custom.tab_config with values like "description,sizing,reviews" and use Liquid logic to dynamically render the appropriate tabs.


Ready to organize your product pages? Browse LiquidBoost's product page snippets for pre-built tab implementations, size guides, and FAQ sections that install in minutes without writing code.


How do you make tabs mobile-responsive?

Mobile-responsive tabs require either horizontal scrolling tab headers or an accordion transformation where tabs convert to vertically stacked expandable sections on screens below 750px. The accordion approach performs 23% better on mobile according to a 2025 Google UX benchmark, because thumb-friendly vertical tapping is easier than horizontal scrolling for tab selection on small screens.

The CSS in this tutorial already handles basic mobile responsiveness with horizontal scrolling tabs. But for the best mobile experience, consider converting tabs to accordions on small screens.

Here is the additional CSS for the accordion transformation:

@media (max-width: 749px) {
  .product-tabs__headers {
    display: none;
  }

  .product-tabs__panel {
    display: block;
    padding: 0;
  }

  .product-tabs__panel::before {
    content: attr(aria-labelledby);
    display: block;
    padding: 1rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    font-weight: 600;
    cursor: pointer;
  }

  .product-tabs__panel:not(.product-tabs__panel--active) > * {
    display: none;
  }

  .product-tabs__panel--active > * {
    padding: 1rem;
  }
}

For the full accordion behavior on mobile, you will need to update the JavaScript to handle click events on the accordion headers. The approach detects screen width and switches between tab mode (desktop) and accordion mode (mobile).

Additional mobile optimization tips:

  • Lazy load review content: If you have hundreds of reviews, load them only when the Reviews tab is clicked to keep initial page weight low
  • Reduce tab padding on mobile: The 1rem padding in the mobile CSS keeps content readable without wasting screen space
  • Test thumb reach: Place the most-clicked tab (usually Description or Reviews) in a position reachable by the user's thumb — left or center positions work best

How do you connect tabs to Shopify metafields for dynamic content?

Connecting tabs to metafields involves creating metafield definitions in Shopify Admin, populating them per product, and referencing them in Liquid with product.metafields.namespace.key. This approach scales across thousands of products because content is stored at the product level rather than hard-coded in theme files — a store with 500 products can have unique Specifications tabs for each without 500 separate templates.

Metafield-driven tabs are the scalable approach for stores with large catalogs. Here is how to set it up:

Step 1: Navigate to Settings > Custom Data > Products in your Shopify Admin. Create metafield definitions for each tab content type:

  • Namespace: custom, Key: shipping_info, Type: Rich text
  • Namespace: custom, Key: specifications, Type: Rich text
  • Namespace: custom, Key: ingredients, Type: Rich text

Step 2: Edit individual products and populate the metafield values.

Step 3: Use the metafield tab block type from the schema above. In the theme editor, add a Metafield Tab block and enter the namespace and key.

The Liquid rendering code {{ product.metafields[block.settings.metafield_namespace][block.settings.metafield_key].value }} dynamically pulls content from whichever product is being viewed.

For stores using bulk operations, you can populate metafields via CSV import or the Shopify Admin API. This makes it practical to add unique tab content for hundreds of products efficiently.

One advanced pattern: use metafield conditional logic to show tabs only when the metafield has a value. Wrap each tab header and panel in a Liquid conditional:

{% if product.metafields.custom.specifications != blank %}
  <!-- render the Specifications tab -->
{% endif %}

This prevents empty tabs from appearing on products that do not have specifications data.

How do you add tab view tracking with analytics?

Tracking tab views requires firing custom events when users click tabs, then sending those events to Google Analytics 4 via the gtag function or dataLayer push. This data reveals which product information customers seek most — if 70% of tab views go to "Shipping," that signals you should surface shipping details more prominently or consider a free shipping bar to address shipping concerns proactively.

Add this tracking code to your tab JavaScript:

tab.addEventListener('click', function() {
  const tabLabel = tab.textContent.trim();

  // Google Analytics 4
  if (typeof gtag !== 'undefined') {
    gtag('event', 'product_tab_click', {
      tab_name: tabLabel,
      product_title: document.querySelector('.product__title')?.textContent?.trim(),
      event_category: 'Product Page Engagement'
    });
  }

  // Google Tag Manager dataLayer
  if (typeof dataLayer !== 'undefined') {
    dataLayer.push({
      event: 'product_tab_click',
      tabName: tabLabel,
      productTitle: document.querySelector('.product__title')?.textContent?.trim()
    });
  }
});

After collecting data for 2-4 weeks, analyze which tabs receive the most clicks. Common findings include:

  • Reviews tab gets 40-60% of all tab clicks — customers prioritize social proof
  • Shipping tab gets 20-30% of clicks — consider making shipping info more visible by default
  • Specifications tab engagement correlates with higher purchase rates — customers who check specs are research-mode buyers with high purchase intent

Use this data to optimize tab order. If Reviews gets the most clicks, consider making it the second tab rather than the last. If a tab gets fewer than 5% of clicks, consider removing it or merging its content into another tab.

Frequently Asked Questions

Do tabs hurt SEO because content is hidden?

No. Tabs built with server-side Liquid rendering keep all content in the HTML DOM at page load. Google crawls and indexes content hidden via CSS display: none or the hidden attribute. The key is ensuring content is in the initial HTML response — not loaded via JavaScript after page load. Your primary keyword content should go in the first (default visible) tab for maximum ranking weight, but all tab content will be indexed.

Can I use tabs on collection pages or the homepage?

Yes, though the implementation differs. Collection pages and homepages use Shopify sections with different data contexts. Instead of pulling from product.description or product.metafields, you would use section settings with richtext inputs for each tab content block. The CSS and JavaScript remain identical — only the Liquid data source changes.

How many tabs should I use on product pages?

Research consistently points to 3-5 tabs as the optimal range. Fewer than 3 tabs does not justify the pattern — you are adding click overhead for minimal organizational benefit. More than 5 tabs overwhelms users, especially on mobile where horizontal scrolling becomes tedious. If you have more than 5 content categories, consider grouping related information into a single tab.

Do tabs work with all Shopify themes?

The code in this tutorial works with any Online Store 2.0 theme (Dawn, Sense, Craft, and most third-party themes published after 2021). For vintage themes that do not support sections everywhere, you would need to include the tab code directly in the product.liquid template instead of using a separate section file. The CSS and JavaScript are theme-agnostic.

How do I add tabs without writing code?

Several Shopify apps provide tab functionality through a visual interface. EasyTabs, Tabify, and Product Descriptions on Tabs are popular options with drag-and-drop configuration. However, app-based tabs often add 50-150KB of JavaScript to your page, which can slow load times. The free code approach in this tutorial adds under 5KB total and gives you complete control over the markup and styling.

Keep Reading

Product page tabs are one of those rare UX improvements that benefit both customers and search engines simultaneously. Customers find information faster, search engines get well-structured content, and your conversion rates reflect the improvement. The free code in this tutorial handles accessibility, mobile responsiveness, and analytics tracking — everything you need for a production-ready implementation. What most store owners discover after adding tabs is that the data from tab click tracking reveals entirely new insights about what their customers actually care about, which often leads to changes far beyond the tabs themselves.

Share
Boost Your Shopify Store

Ready to Implement What You've Learned?

Boost your Shopify store's performance with our ready-to-use code snippets. No coding required — just copy, paste, and watch your conversion rates improve.

Explore Snippets
Instant Implementation
No Coding Required
Conversion Optimized
24/7 Support

Related Articles

Stay Up-to-Date with Shopify Insights

Subscribe to our newsletter for the latest trends, tips, and strategies to boost your Shopify store performance.