This solution requires Parallax 3.0+, Retina 4.0+, Mobilia 5.0+, Responsive 6.0+ or Turbo 2.0+.
If you would like to have the same tabs on every product page, it can be time consuming to manually add the tabs HTML code to every product description, especially if you find later you need to make an update to the tab content.
Instead of manually adding the code, it is possible to edit the product template to automatically include the tabs on every product page.
-
First open the HTML/CSS editor using these steps.
-
Next, locate the "Sections" folder and click it to expand it.
-
Now, find the file "product-template.liquid" and click it to open it.
-
Locate this code:
{{ product.description | split: '<!-- split -->' | first }}
Notes: You will see two versions of this code, one for when the product description is above the "add to cart" button and one for when it is below it. See the code example below for details on exact placement. In addition, if you are using the product.details template, you will also need to update product-details-template.liquid in the same way. -
After this code, add the tabs HTML code. Edit the title titles and content as needed.
Different tabs
If you have a few products that require a different set of tabs (or not tabs at all), there is a
- First, identify the handle of the product page.
- Above the tabs HTML code, add this "if statement" code:
{% if product.handle == 'your-product-handle' %}
, replacing 'your-product-handle' with the handle you identified in step 1. - After your tabs HTML, add this code:
{% endif %}
- If you prefer to hide tabs completely on a particular product page, simply use this code:
{% if product.handle == 'your-product-handle' %}{% endif %}
- You can repeat this process with additional product handles. Please be aware, however, that excessive use of this code can cause performance or code issues.
The "if statement" above can also be used within tab content if you will only have slight variations with tab content:
<ul class="tabs-content">
<li class="active" id="tab1">{% if product.handle == 'your-product-handle' %}This product is not eligible for free shipping.{% endif %} Normal tab content</li>
Updating your tabs
If, in the future, you need to update information in your tabs, you can now edit the template or templates you edited above and all products using that template will automatically update with the new tab content.
If you used the "different tabs" approach above, keep in mind you will need to edit each block of code within the "if" statement separately.
Important notes and limitations
- Unless you use the "different tabs" approach outlined above, ALL products that use the template you edit will have the SAME content.
- However, products using product.details (product-details-template.liquid) can have different tabs than ones using the standard product template (product-template.liquid), but ALL of the products using product.details will have the SAME tabs, while all of the ones using the standard product template will have the SAME content.
- If you are using both product.details and product, you will need to add the tabs HTML to BOTH files product-details-template.liquid and product-template.liquid.
- The content from your tabs will not be included in the product description rich snippets or Open Graph tags.
- The content from your tabs will also not appear in quick shop overlays.