{% liquid if section.settings.heading != blank assign heading = section.settings.heading else assign heading = 'testimonials.heading' | t endif if section.settings.subheading != blank assign subheading = section.settings.subheading else assign subheading = 'testimonials.subheading' | t endif assign visible_testimonials = 0 for block in section.blocks assign slide_product = block.settings.product assign skip_slide = false if slide_product != blank unless slide_product.available assign skip_slide = true endunless endif unless skip_slide assign visible_testimonials = visible_testimonials | plus: 1 endunless endfor %}

{{ heading | escape }}

{% if subheading != blank %}

{{ subheading | escape }}

{% endif %}
{% if visible_testimonials > 0 %}
{% assign shown_slides = 0 %} {% for block in section.blocks %} {% liquid assign slide_product = block.settings.product assign skip_slide = false if slide_product != blank unless slide_product.available assign skip_slide = true endunless endif %} {% if skip_slide %} {% continue %} {% endif %}
0 %}hidden{% endif %} >
{% if block.settings.author != blank %}

{{ block.settings.author | escape }}

{% endif %}
{% if block.settings.quote != blank %}

{{ block.settings.quote | escape }}

{% endif %}
{% assign shown_slides = shown_slides | plus: 1 %} {% endfor %}
{% assign shown_products = 0 %} {% for block in section.blocks %} {% liquid assign slide_product = block.settings.product assign skip_slide = false if slide_product != blank unless slide_product.available assign skip_slide = true endunless endif %} {% if skip_slide %} {% continue %} {% endif %} {% liquid assign slide_product = block.settings.product assign variant = blank assign card_image = blank assign hover_image = blank assign subtitle = blank assign show_compare = false if slide_product != blank assign variant = slide_product.selected_or_first_available_variant assign card_image = slide_product.featured_image for image in slide_product.images offset: 1 limit: 1 assign hover_image = image endfor assign subtitle = slide_product.metafields.custom.subtitulo.value | default: slide_product.metafields.custom.subtitulo if subtitle == blank assign subtitle = slide_product.metafields.custom.subtitle.value | default: slide_product.metafields.custom.subtitle endif if subtitle == blank assign subtitle = slide_product.metafields.custom.presentacion.value | default: slide_product.metafields.custom.presentacion endif if subtitle == blank and variant.title != 'Default Title' assign subtitle = variant.title endif if variant.compare_at_price > variant.price assign show_compare = true endif endif %}
0 %}hidden{% endif %}> {% if slide_product != blank %}
{{ slide_product.title | escape }} {% if subtitle != blank %}

{{ subtitle | escape }}

{% endif %}

{{ variant.price | money_without_trailing_zeros }} {% if show_compare %} {{ variant.compare_at_price | money_without_trailing_zeros }} {% endif %}

{% endif %}
{% assign shown_products = shown_products | plus: 1 %} {% endfor %}
{% endif %}
{% javascript %} (() => { const setCartCount = (count) => { const link = document.querySelector('.header__cart'); if (!link || count < 1) return; let badge = link.querySelector('[data-cart-count]'); if (!badge) { badge = document.createElement('span'); badge.className = 'absolute right-0 top-0 flex h-4 min-w-4 items-center justify-center rounded-full bg-brand-mint px-[3px] text-[10px] font-medium leading-none text-black'; badge.setAttribute('data-cart-count', ''); link.appendChild(badge); } badge.textContent = String(count); }; const boot = (root) => { if (root.dataset.ready === 'true') return; root.dataset.ready = 'true'; const slides = [...root.querySelectorAll('[data-slide]')]; const products = [...root.querySelectorAll('[data-product]')]; const prev = root.querySelector('[data-prev]'); const next = root.querySelector('[data-next]'); let index = 0; const paint = () => { slides.forEach((slide, slideIndex) => { slide.hidden = slideIndex !== index; }); products.forEach((product, productIndex) => { product.hidden = productIndex !== index; }); if (prev) prev.disabled = index <= 0; if (next) next.disabled = index >= slides.length - 1; }; if (prev) { prev.addEventListener('click', () => { if (index <= 0) return; index -= 1; paint(); }); } if (next) { next.addEventListener('click', () => { if (index >= slides.length - 1) return; index += 1; paint(); }); } paint(); }; const bootAll = (scope) => { scope.querySelectorAll('[data-testimonials]').forEach(boot); }; bootAll(document); document.addEventListener('shopify:section:load', (event) => { bootAll(event.target); }); if (!window.__seasonTestimonials) { window.__seasonTestimonials = true; document.addEventListener('submit', async (event) => { if (event.defaultPrevented) return; const form = event.target; if (!(form instanceof HTMLFormElement) || !form.classList.contains('testimonials__form')) return; const root = form.closest('[data-testimonials]'); if (!root) return; event.preventDefault(); const button = event.submitter; if (button) button.disabled = true; try { const response = await fetch(root.dataset.cartAddUrl, { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body: JSON.stringify({ id: form.querySelector('[name="id"]').value, quantity: 1, }), }); const data = await response.json(); if (response.ok) { if (button && button.hasAttribute('data-buy') && root.dataset.checkoutUrl) { window.location.href = root.dataset.checkoutUrl; return; } document.dispatchEvent(new CustomEvent('season:cart:open')); const cart = await fetch('/cart.js').then((result) => result.json()); setCartCount(cart.item_count); } else if (data.description) { window.alert(data.description); } } catch (error) { window.alert(error.message); } finally { if (button) button.disabled = false; } }); } })(); {% endjavascript %} {% schema %} { "name": "t:testimonials.name", "tag": "section", "class": "testimonials-section", "disabled_on": { "groups": ["header", "footer"] }, "settings": [ { "type": "text", "id": "heading", "label": "t:testimonials.heading", "default": "Confianza que se construye con cada rutina" }, { "type": "text", "id": "subheading", "label": "t:testimonials.subheading", "default": "+1,500 pieles ya encontraron su rutina Seasons" } ], "blocks": [ { "type": "review", "name": "t:testimonials.review", "settings": [ { "type": "textarea", "id": "quote", "label": "t:testimonials.quote", "default": "Tengo piel sensible y atópica y es el único bloqueador que me cae bien, la sensación es increíble y he notado que se disminuyen súper rápido las marcas post acné, lo amo, la verdad 😌💕" }, { "type": "text", "id": "author", "label": "t:testimonials.author", "default": "María José" }, { "type": "range", "id": "rating", "label": "t:testimonials.rating_label", "min": 1, "max": 5, "step": 1, "default": 5 }, { "type": "product", "id": "product", "label": "t:testimonials.product" } ] } ], "presets": [ { "name": "t:testimonials.name", "blocks": [ { "type": "review" } ] } ] } {% endschema %}