<{* Check if description contains tab. *}>
<{assign var="pattern" value='/^([\s\S]+?)(?=\s
\[tab)/'}>
<{assign var="strippedDescription" value=$description|regex_replace:$pattern:''}>
<{if $description|count_characters === $strippedDescription|count_characters}>
<{assign var="hasTabs" value=false}>
<{else}>
<{assign var="hasTabs" value=true}>
<{/if}>
<{* Render content. *}>
<{if ! $hasTabs}>
<{assign var="strippedDescription" value=$description|strip_tags}>
<{if $strippedDescription eq ""}>
<{assign var="description" value="No description available"|t}>
<{/if}>
<{* Render content for simple descriptions without additional tabs. *}>
<{include file="components/accordion.html" type="description" icon="document-text" title="Description"|t content=$description content_type="wysiwyg" open=$settings.product.show_description_tab_by_default class="prose prose--sm"}>
<{else}>
<{* Render content for advanced descriptions with additional tabs. *}>
<{assign var="introPattern" value='/^([\s\S]+?)(?=\s
\[tab)/'}>
<{capture name="introReplacement" assign="introReplacement"}>
<{include file="components/accordion.html" type="description" title="Description"|t content="\$1" open=false class="prose prose--sm"}>
<{/capture}>
<{assign var="outroPattern" value='/(?<=\[\/tab\]\<\/p\>)\s*((?!\s)((?!\[)[\s\S])+)$/'}>
<{capture name="outroReplacement" assign="outroReplacement"}>
<{include file="components/accordion.html" type="description" title="More information"|t content="\$1" open=false class="prose prose--sm"}>
<{/capture}>
<{assign var="tabPattern" value='/
\[tab type="([a-zA-Z0-9_ ]*)" title="([a-zA-Z0-9_ ]*)"\]<\/p>\s*([\s\S]*?(?=\s*<))\s*
\[\/tab\]<\/p>/'}>
<{capture name="tabReplacement" assign="tabReplacement"}>
<{include file="components/accordion.html" type="\$1" title="\$2" content="\$3" open=false class="prose prose--sm"}>
<{/capture}>
<{assign var="washing" value=$product->getMetaValue('washing')}>
<{if $washing}>
<{assign var="washingDetailsPattern" value='/
\[tab type="([a-zA-Z0-9_ ]*)" title="([a-zA-Z0-9_ ]*)"\]<\/p>\s*([\s\S]*?(?=\s*<))\s*
\[\/tab\]<\/p>/'}>
<{assign var="washing" value=","|explode:$washing}>
<{capture assign="washingDetailsReplacement"}>
[tab type="washing" title="$2"]
$3
[/tab]
<{/capture}>
<{assign var="washingDetailsReplacement" value=$washingDetailsReplacement|strip}>
<{assign var="description" value=$description|regex_replace:$washingDetailsPattern:$washingDetailsReplacement}>
<{/if}>
<{assign var="description" value=$description|regex_replace:$introPattern:$introReplacement}>
<{assign var="description" value=$description|regex_replace:$outroPattern:$outroReplacement}>
<{assign var="description" value=$description|regex_replace:$tabPattern:$tabReplacement}>
<{$description}>
<{/if}>
<{* Render default tabs. *}>
<{if $settings.integrations.enable_trustpilot && $settings.integrations.trustpilot_template_id_product_reviews}>
<{capture assign="reviewsTitle"}>
<{t}>Reviews<{/t}>
<{/capture}>
<{capture assign="reviewsContent"}>
<{include file="components/widget-trustpilot.html" template_id=$settings.integrations.trustpilot_template_id_product_reviews height="400px" width="100%" sku=$product->getOwnId()}>
<{/capture}>
<{include file="components/accordion.html" type="reviews" icon="star-outline" title=$reviewsTitle content=$reviewsContent open=false id="reviews"}>
<{elseif $reviews}>
<{capture assign="reviewsTitle"}>
<{t}>Reviews<{/t}>
<{include file="components/rating.html" variant="sm" product=$product reviews=$reviews}>
<{/capture}>
<{capture assign="reviewsContent"}>
<{section name="k" loop=$reviews}>
<{assign var="review" value=$reviews[k]}>
<{if $review->getDescription()}>
<{$review->getDescription()}>
<{else}>
<{t x=$review->getRating() y=$reviewFirstName}>No review written. {x} stars given by {y}.<{/t}>
<{/if}>
<{/section}>
<{/capture}>
<{include file="components/accordion.html" type="reviews" icon="star-outline" title=$reviewsTitle content=$reviewsContent open=false id="reviews"}>
<{/if}>
<{if $settings.product.enable_washing_instructions}>
<{assign var="labels" value=$product->getProductLabels()}>
<{if $labels}>
<{assign var="washingTitleFallback" value="Washing instructions"|t}>
<{assign var="washingTitle" value=$settings.product.washing_instructions_title|default:$washingTitleFallback}>
<{assign var="pageTag" value=""}>
<{capture assign="washingInstructions"}>
<{assign var="washingtag" value=$product->getProductLabels()}>
<{assign var="hasResult" value=false}>
<{section name="i" loop=$washingtag}>
<{if !$hasResult}>
<{assign var="tag" value=$washingtag[i]->getTag()}>
<{if $webshop->getPagesByTag($tag)}>
<{if $tag|strstr:'washing-instruction'}>
<{assign var="pageTag" value=$webshop->getPagesByTag($tag)}>
<{$pageTag[0]->getText()}>
<{assign var="hasResult" value=true}>
<{/if}>
<{/if}>
<{/if}>
<{/section}>
<{/capture}>
<{if $pageTag}>
<{include file="components/accordion.html" type="washing" icon_group="washicons" icon="washing" title=$washingTitle content=$washingInstructions open=false class="prose prose--sm"}>
<{/if}>
<{/if}>
<{/if}>
<{if $settings.product.enable_size_guide}>
<{assign var="labels" value=$product->getProductLabels()}>
<{if $labels}>
<{assign var="sizeTitleFallback" value="Size guide"|t}>
<{assign var="sizeTitle" value=$settings.product.size_guide_title|default:$sizeTitleFallback}>
<{assign var="pageTag" value=""}>
<{capture assign="sizeguideinstructions"}>
<{assign var="sizeTag" value=$product->getProductLabels()}>
<{assign var="hasResult" value=false}>
<{section name="a" loop=$sizeTag}>
<{if !$hasResult}>
<{assign var="tag" value=$sizeTag[a]->getTag()}>
<{if $webshop->getPagesByTag($tag)}>
<{if $tag|strstr:'size-guide'}>
<{assign var="pageTag" value=$webshop->getPagesByTag($tag)}>
<{$pageTag[0]->getText()}>
<{assign var="hasResult" value=true}>
<{/if}>
<{/if}>
<{/if}>
<{/section}>
<{/capture}>
<{if $pageTag}>
<{include file="components/accordion.html" type="size" icon="chart-bar" title=$sizeTitle content=$sizeguideinstructions open=false class="prose prose--sm"}>
<{/if}>
<{/if}>
<{/if}>
<{if $settings.product.enable_tab_details}>
<{capture assign="productDetails"}>
<{include file="components/product-table-details.html"}>
<{/capture}>
<{include file="components/accordion.html" type="details" icon="information" title="Product details"|t content=$productDetails open=false class="prose prose--sm"}>
<{/if}>
<{if $settings.terms.delivery && $settings.product.enable_tab_delivery}>
<{capture assign="deliveryTerms"}><{$settings.terms.delivery}><{/capture}>
<{include file="components/accordion.html" type="delivery" icon="truck" title="Delivery"|t content=$deliveryTerms open=false class="prose prose--sm"}>
<{/if}>
<{if $settings.terms.return && $settings.product.enable_tab_return}>
<{capture assign="returnTerms"}><{$settings.terms.return}><{/capture}>
<{include file="components/accordion.html" type="return" icon="arrow-return" title="Return"|t content=$returnTerms open=false class="prose prose--sm"}>
<{/if}>
<{if $settings.terms.payment && $settings.product.enable_tab_payment}>
<{capture assign="paymentTerms"}><{$settings.terms.payment}><{/capture}>
<{include file="components/accordion.html" type="payment" icon="credit-card" title="Payment"|t content=$paymentTerms open=false class="prose prose--sm"}>
<{/if}>
<{assign var="files" value=$product->getPdfFiles()}>
<{if $files}>
<{capture assign="accordionContent"}>
<{/capture}>
<{include file="components/accordion.html" type="pdf" icon="cloud-arrow-down" title="Downloads"|t content=$accordionContent open=false class="prose prose--sm"}>
<{/if}>
<{if $settings.product.enable_tab_question}>
<{capture assign="askQuestionForm"}>
<{include file="components/product-ask-question.html"}>
<{/capture}>
<{assign var="tabTitleFallback" value="Got questions?"|t}>
<{assign var="askQuestionTabTitle" value=$settings.product.ask_question_title|default:$tabTitleFallback}>
<{include file="components/accordion.html" type="payment" icon="question-mark" title=$askQuestionTabTitle content=$askQuestionForm open=false}>
<{/if}>