Hello there,
I am using debut theme.
I have got code 1 for Splitting product description. Code 2 for Add tabs.
Since Code 1 and Code 2 need to replace the same original code. It makes my content shows twice.. I think combine these two code would help. Many many thanks in advance.
Code 1 Splitting product description:
{% include 'tabbed-description' %}
Code 2 Add tabs
{{ product.description | split: '' | first }}
{% if product.description contains "" %}
{{ product.description | split: '' | last }}
{% endif %}
Original code on product-template.liquid
{{ product.description }}
I wanna make this: https://m79hzwirmckh22ml-36542939273.shopifypreview.com/products_preview?preview_key=5a6b49cb9664d62683cced6627def847 (not quite sure if you could open it, so I attach a picture below)
More details for tabbed-description.liquid on Snippets
{% comment %}
if combine_pretext is false, the text before the first ###### will be shown above all tabs, otherwise added to the first tab
{% endcomment %}
{% assign combine_pretext = false %}
{% assign description = tabbed-description | default: product.description %}
{% if description contains "###### " %}
{% assign tab_heads = '' %}
{% assign tab_texts = '' %}
{% assign pretext = '' %}
{% assign chunks = description | strip | split: "###### " %}
{% for c in chunks %}
{% if c contains "" %}
{% assign chunk = c | split: "" %}
{% assign tab_heads = tab_heads | append: ",," | append: chunk.first %}
{% assign tab_texts = tab_texts | append: ",," %}
{% if pretext != blank and combine_pretext %}
{% assign tab_texts = tab_texts | append: pretext | append: "
" %}
{% assign pretext = '' %}
{% endif %}
{% assign tab_texts = tab_texts | append: chunk.last %}
{% elsif forloop.first %}
{% assign pretext = c %}
{% endif %}
{% endfor %}
{% assign tab_heads = tab_heads | remove_first: ",," | split: ",," %}
{% assign tab_texts = tab_texts | remove_first: ",," | split: ",," %}
{% assign index = 1 %}
{% if pretext != blank and combine_pretext == false %}
{{ pretext }}
{% endif %}
{% for head in tab_heads %}
- {{ head }}
{% assign index = index | plus: 1 %}
{% endfor %}
{% assign index = 1 %}
{% for text in tab_texts %}
{{ text }}
{% assign index = index | plus: 1 %}
{% endfor %}
{% else %}
{{ description }}
{% endif %}
