Ajustes antes de produccion
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{% doc %}
|
||||
Renders one product card for the best sellers slider.
|
||||
Sold-out products are skipped so the card can always be added or bought.
|
||||
|
||||
@param {product} product - Product to display
|
||||
@param {string} [form_suffix] - Suffix that keeps the add-to-cart form id unique
|
||||
@@ -8,6 +9,7 @@
|
||||
{% render 'bestsellers-card', product: product, form_suffix: section.id %}
|
||||
{% enddoc %}
|
||||
|
||||
{% if product.available %}
|
||||
{% liquid
|
||||
assign variant = product.selected_or_first_available_variant
|
||||
assign card_image = product.featured_image
|
||||
@@ -27,29 +29,12 @@
|
||||
if subtitle == blank and variant.title != 'Default Title'
|
||||
assign subtitle = variant.title
|
||||
endif
|
||||
|
||||
assign skin_label = product.metafields.custom.tipo_de_piel.value | default: product.metafields.custom.tipo_de_piel
|
||||
if skin_label == blank
|
||||
assign skin_label = product.metafields.custom.skin_type.value | default: product.metafields.custom.skin_type
|
||||
endif
|
||||
if skin_label == blank
|
||||
assign skin_fallback = blank
|
||||
for tag in product.tags
|
||||
assign tag_label = tag | downcase
|
||||
if tag_label contains 'piel'
|
||||
if skin_fallback == blank
|
||||
assign skin_fallback = tag
|
||||
endif
|
||||
if tag_label contains 'pieles' or tag_label contains 'piel '
|
||||
assign skin_label = tag
|
||||
break
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
if skin_label == blank
|
||||
assign skin_label = skin_fallback
|
||||
endif
|
||||
endif
|
||||
%}
|
||||
{% capture collection_label %}
|
||||
{% render 'product-collection-label', product: product %}
|
||||
{% endcapture %}
|
||||
{% liquid
|
||||
assign collection_label = collection_label | strip
|
||||
|
||||
assign rating_value = 0
|
||||
assign rating_count = 0
|
||||
@@ -100,8 +85,8 @@
|
||||
|
||||
<div class="bestsellers__badges">
|
||||
<span class="bestsellers__badge bestsellers__badge--best">{{ 'bestsellers.badge' | t }}</span>
|
||||
{% if skin_label != blank %}
|
||||
<span class="bestsellers__badge bestsellers__badge--skin">{{ skin_label | escape }}</span>
|
||||
{% if collection_label != blank %}
|
||||
<span class="bestsellers__badge bestsellers__badge--skin">{{ collection_label | escape }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -183,3 +168,4 @@
|
||||
</div>
|
||||
|
||||
</article>
|
||||
{% endif %}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
{% doc %}
|
||||
Edge arrows for horizontal carousels (same look as the header submenu arrows).
|
||||
"Prev" only shows when there is content behind, "next" only when there is more ahead.
|
||||
Add a selector to CAROUSELS to enable it on another scroller.
|
||||
|
||||
@example
|
||||
{% render 'carousel-edge-arrows' %}
|
||||
{% enddoc %}
|
||||
<style>
|
||||
.edge-arrow{position:absolute;z-index:4;display:grid;place-items:center;width:2.25rem;height:2.25rem;margin:0;padding:0;border:0;border-radius:50%;background:#fff;color:#000;box-shadow:0 .125rem .5rem rgba(0,0,0,.18);cursor:pointer;transform:translateY(-50%);transition:opacity .2s ease;-webkit-tap-highlight-color:transparent}
|
||||
.edge-arrow[hidden]{display:none}
|
||||
.edge-arrow:active{transform:translateY(-50%) scale(.96)}
|
||||
.edge-arrow svg{display:block;width:.5rem;height:.875rem}
|
||||
.edge-arrow--prev{left:.5rem}
|
||||
.edge-arrow--prev svg{transform:rotate(180deg)}
|
||||
.edge-arrow--next{right:.5rem}
|
||||
.edge-arrow:focus-visible{outline:2px solid #000;outline-offset:2px}
|
||||
/* Mobile: cards snap to the center only after the user starts interacting (initial view stays left-aligned). */
|
||||
@media (max-width: 767px) {
|
||||
[data-edge-center="on"] .bestsellers__card,
|
||||
[data-edge-center="on"] .routine__card { scroll-snap-align: center; }
|
||||
}
|
||||
</style>
|
||||
<script nolazy>
|
||||
(function () {
|
||||
if (window.__edgeArrows) return;
|
||||
window.__edgeArrows = true;
|
||||
var CAROUSELS = '.bestsellers__viewport, .routine__steps';
|
||||
var CARDS = '.bestsellers__card, .routine__card';
|
||||
var mobileMq = window.matchMedia('(max-width: 767px)');
|
||||
var cardsOf = function (viewport) {
|
||||
return [].slice.call(viewport.querySelectorAll(CARDS)).filter(function (c) { return c.offsetParent !== null; });
|
||||
};
|
||||
var ICON = '<svg width="8" height="14" viewBox="0 0 8 14" aria-hidden="true" focusable="false"><path d="M1 1.2 6.8 7 1 12.8" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"></path></svg>';
|
||||
|
||||
var make = function (dir) {
|
||||
var b = document.createElement('button');
|
||||
b.type = 'button';
|
||||
b.className = 'edge-arrow edge-arrow--' + (dir < 0 ? 'prev' : 'next');
|
||||
b.setAttribute('aria-label', dir < 0 ? 'Ver anteriores' : 'Ver siguientes');
|
||||
b.dataset.edgeScroll = String(dir);
|
||||
b.innerHTML = ICON;
|
||||
b.hidden = true;
|
||||
return b;
|
||||
};
|
||||
|
||||
var setup = function (viewport) {
|
||||
if (viewport.dataset.edgeArrows) return;
|
||||
viewport.dataset.edgeArrows = '1';
|
||||
var host = viewport.parentElement;
|
||||
if (getComputedStyle(host).position === 'static') host.style.position = 'relative';
|
||||
var prev = make(-1), next = make(1);
|
||||
host.appendChild(prev);
|
||||
host.appendChild(next);
|
||||
|
||||
var place = function () {
|
||||
// Vertically center on the first card image (like the submenu arrows), else on the viewport.
|
||||
var img = viewport.querySelector('img');
|
||||
var hostTop = host.getBoundingClientRect().top;
|
||||
var top;
|
||||
if (img && img.getBoundingClientRect().height > 40) {
|
||||
var r = img.getBoundingClientRect();
|
||||
top = r.top - hostTop + r.height / 2;
|
||||
} else {
|
||||
var v = viewport.getBoundingClientRect();
|
||||
top = v.top - hostTop + v.height / 2;
|
||||
}
|
||||
prev.style.top = next.style.top = Math.round(top) + 'px';
|
||||
};
|
||||
// Mobile centering is armed on the first interaction only: on load the first card stays
|
||||
// left-aligned (no empty gap). After that, cards snap to the middle and the last card gets
|
||||
// trailing space so it can center too.
|
||||
var armed = false;
|
||||
var center = function () {
|
||||
var cards = cardsOf(viewport);
|
||||
cards.forEach(function (c) { c.style.marginRight = ''; });
|
||||
if (!mobileMq.matches || !cards.length || !armed) { viewport.removeAttribute('data-edge-center'); return; }
|
||||
viewport.setAttribute('data-edge-center', 'on');
|
||||
var side = Math.max(0, (viewport.clientWidth - cards[0].getBoundingClientRect().width) / 2);
|
||||
var padR = parseFloat(getComputedStyle(viewport).paddingRight) || 0;
|
||||
cards[cards.length - 1].style.marginRight = Math.max(0, side - padR) + 'px';
|
||||
};
|
||||
var arm = function () {
|
||||
if (armed || !mobileMq.matches) return;
|
||||
armed = true;
|
||||
center();
|
||||
update();
|
||||
};
|
||||
viewport.addEventListener('touchstart', arm, { passive: true, once: true });
|
||||
viewport.addEventListener('pointerdown', arm, { passive: true, once: true });
|
||||
var currentIndex = function (cards) {
|
||||
var vr = viewport.getBoundingClientRect(), mid = vr.left + vr.width / 2, best = 0, dist = Infinity;
|
||||
cards.forEach(function (c, i) {
|
||||
var r = c.getBoundingClientRect(), d = Math.abs(r.left + r.width / 2 - mid);
|
||||
if (d < dist) { dist = d; best = i; }
|
||||
});
|
||||
return best;
|
||||
};
|
||||
var goCard = function (dir) {
|
||||
var cards = cardsOf(viewport);
|
||||
if (!cards.length) return false;
|
||||
var target = cards[Math.min(cards.length - 1, Math.max(0, currentIndex(cards) + dir))];
|
||||
var vr = viewport.getBoundingClientRect(), r = target.getBoundingClientRect();
|
||||
viewport.scrollBy({ left: (r.left + r.width / 2) - (vr.left + vr.width / 2), behavior: 'smooth' });
|
||||
return true;
|
||||
};
|
||||
var update = function () {
|
||||
var max = viewport.scrollWidth - viewport.clientWidth;
|
||||
var x = Math.abs(viewport.scrollLeft);
|
||||
// Small tolerance: some carousels start with a few px of offset/padding.
|
||||
prev.hidden = !(max > 24 && x > 24);
|
||||
next.hidden = !(max > 24 && x < max - 24);
|
||||
};
|
||||
var raf = 0;
|
||||
viewport.addEventListener('scroll', function () {
|
||||
if (raf) return;
|
||||
raf = requestAnimationFrame(function () { raf = 0; update(); });
|
||||
}, { passive: true });
|
||||
window.addEventListener('resize', function () { center(); place(); update(); });
|
||||
[prev, next].forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var dir = Number(btn.dataset.edgeScroll);
|
||||
arm();
|
||||
if (mobileMq.matches && goCard(dir)) return;
|
||||
viewport.scrollBy({ left: dir * viewport.clientWidth * 0.8, behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
if ('ResizeObserver' in window) new ResizeObserver(function () { place(); update(); }).observe(viewport);
|
||||
viewport.querySelectorAll('img').forEach(function (img) { if (!img.complete) img.addEventListener('load', place, { once: true }); });
|
||||
center();
|
||||
place();
|
||||
update();
|
||||
};
|
||||
|
||||
var init = function () { document.querySelectorAll(CAROUSELS).forEach(setup); };
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init); else init();
|
||||
document.addEventListener('shopify:section:load', init);
|
||||
})();
|
||||
</script>
|
||||
@@ -0,0 +1,69 @@
|
||||
{% doc %}
|
||||
Merges duplicate cart lines (same variant, same purchase type: one-time or the same
|
||||
subscription plan) into a single line with the summed quantity. Duplicates appear when two
|
||||
"add" requests for the same product reach Shopify at the same time, or when apps add hidden
|
||||
line properties. Free-gift lines ($0 or _kv_gift) are never touched.
|
||||
Exposes window.seasonsMergeCartLines() -> Promise<boolean> (true when something was merged).
|
||||
|
||||
@example
|
||||
{% render 'cart-merge-lines' %}
|
||||
{% enddoc %}
|
||||
<script nolazy>
|
||||
(function () {
|
||||
if (window.seasonsMergeCartLines) return;
|
||||
var root = (window.Shopify && window.Shopify.routes && window.Shopify.routes.root) || '/';
|
||||
var running = null;
|
||||
var isGift = function (item) {
|
||||
var props = item.properties || {};
|
||||
return item.final_price === 0 || Object.keys(props).some(function (k) { return /gift|regalo/i.test(k); });
|
||||
};
|
||||
var visibleProps = function (item) {
|
||||
var props = item.properties || {}, out = {};
|
||||
Object.keys(props).sort().forEach(function (k) { if (k.charAt(0) !== '_') out[k] = props[k]; });
|
||||
return JSON.stringify(out);
|
||||
};
|
||||
window.seasonsMergeCartLines = function () {
|
||||
if (running) return running;
|
||||
running = fetch(root + 'cart.js', { headers: { Accept: 'application/json' } })
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (cart) {
|
||||
var groups = {};
|
||||
(cart.items || []).forEach(function (item) {
|
||||
if (isGift(item)) return;
|
||||
var plan = item.selling_plan_allocation && item.selling_plan_allocation.selling_plan ? item.selling_plan_allocation.selling_plan.id : 'once';
|
||||
var id = item.variant_id + '|' + plan + '|' + visibleProps(item);
|
||||
(groups[id] = groups[id] || []).push(item);
|
||||
});
|
||||
var updates = {}, merged = false;
|
||||
Object.keys(groups).forEach(function (id) {
|
||||
var lines = groups[id];
|
||||
if (lines.length < 2) return;
|
||||
merged = true;
|
||||
var total = lines.reduce(function (n, l) { return n + l.quantity; }, 0);
|
||||
updates[lines[0].key] = total;
|
||||
lines.slice(1).forEach(function (l) { updates[l.key] = 0; });
|
||||
});
|
||||
if (!merged) return false;
|
||||
return fetch(root + 'cart/update.js', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
||||
body: JSON.stringify({ updates: updates })
|
||||
}).then(function (r) { return r.ok; });
|
||||
})
|
||||
.catch(function () { return false; })
|
||||
.finally(function () { running = null; });
|
||||
return running;
|
||||
};
|
||||
// /cart page: merge on load and reload once if something changed.
|
||||
if (document.querySelector('.cart-page__items')) {
|
||||
window.seasonsMergeCartLines().then(function (merged) {
|
||||
if (merged && !sessionStorage.getItem('seasonsMerged')) {
|
||||
try { sessionStorage.setItem('seasonsMerged', '1'); } catch (e) {}
|
||||
window.location.reload();
|
||||
} else {
|
||||
try { sessionStorage.removeItem('seasonsMerged'); } catch (e) {}
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
@@ -0,0 +1,38 @@
|
||||
{% doc %}
|
||||
Renders a category banner with its photo, title and description on the green panel.
|
||||
|
||||
@param {string} title - Category title
|
||||
@param {string} text - Category description
|
||||
@param {string} image - Optimized image asset filename
|
||||
@param {string} url - Destination collection URL
|
||||
|
||||
@example
|
||||
{% render 'category-card', title: 'Hidratantes', text: 'Descripción', image: 'banner-hidratantes.avif', url: '/collections/hidratantes' %}
|
||||
{% enddoc %}
|
||||
|
||||
<a class="collection__banner category-card" href="{{ url }}">
|
||||
<div class="collection__banner-media">
|
||||
<img
|
||||
class="collection__banner-image"
|
||||
src="{{ image | asset_url }}"
|
||||
alt="{{ title | escape }}"
|
||||
width="960"
|
||||
height="380"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
>
|
||||
</div>
|
||||
<div class="collection__banner-copy">
|
||||
<h2 class="collection__banner-title">{{ title | escape }}</h2>
|
||||
<p class="collection__banner-text">{{ text | escape }}</p>
|
||||
<img
|
||||
class="collection__banner-blob"
|
||||
src="{{ 'Capa_1.avif' | asset_url }}"
|
||||
alt=""
|
||||
width="185"
|
||||
height="210"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
>
|
||||
</div>
|
||||
</a>
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
@param {product} product - Product to display
|
||||
@param {string} [form_suffix] - Keeps the product form id unique
|
||||
@param {string} [badge_mode] - `tags` shows the skin label, `collection` shows the category collection, `none` hides badges
|
||||
|
||||
@example
|
||||
{% render 'collection-card', product: product, form_suffix: section.id %}
|
||||
@@ -28,25 +29,40 @@
|
||||
assign subtitle = variant.title
|
||||
endif
|
||||
|
||||
assign skin_label = product.metafields.custom.tipo_de_piel.value | default: product.metafields.custom.tipo_de_piel
|
||||
if skin_label == blank
|
||||
assign skin_label = product.metafields.custom.skin_type.value | default: product.metafields.custom.skin_type
|
||||
endif
|
||||
|
||||
assign badge_mode = badge_mode | default: 'tags'
|
||||
%}
|
||||
{% if badge_mode == 'collection' %}
|
||||
{% capture collection_label %}
|
||||
{% render 'product-collection-label', product: product %}
|
||||
{% endcapture %}
|
||||
{% endif %}
|
||||
{% liquid
|
||||
assign collection_label = collection_label | strip
|
||||
assign skin_label = blank
|
||||
assign badge_best = false
|
||||
assign badge_recommended = false
|
||||
for tag in product.tags
|
||||
assign tag_label = tag | downcase
|
||||
if tag_label contains 'vendido' or tag_label contains 'bestseller'
|
||||
assign badge_best = true
|
||||
|
||||
if badge_mode != 'none'
|
||||
if badge_mode == 'tags'
|
||||
assign skin_label = product.metafields.custom.tipo_de_piel.value | default: product.metafields.custom.tipo_de_piel
|
||||
if skin_label == blank
|
||||
assign skin_label = product.metafields.custom.skin_type.value | default: product.metafields.custom.skin_type
|
||||
endif
|
||||
endif
|
||||
if tag_label contains 'recomend'
|
||||
assign badge_recommended = true
|
||||
endif
|
||||
if skin_label == blank and tag_label contains 'piel'
|
||||
assign skin_label = tag
|
||||
endif
|
||||
endfor
|
||||
|
||||
for tag in product.tags
|
||||
assign tag_label = tag | downcase
|
||||
if tag_label contains 'vendido' or tag_label contains 'bestseller'
|
||||
assign badge_best = true
|
||||
endif
|
||||
if tag_label contains 'recomend'
|
||||
assign badge_recommended = true
|
||||
endif
|
||||
if badge_mode == 'tags' and skin_label == blank and tag_label contains 'piel'
|
||||
assign skin_label = tag
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
assign rating_value = 0
|
||||
assign rating_count = 0
|
||||
@@ -99,17 +115,21 @@
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
<div class="collection-card__badges">
|
||||
{% if badge_best %}
|
||||
<span class="collection-card__badge collection-card__badge--best">{{ 'bestsellers.badge' | t }}</span>
|
||||
{% endif %}
|
||||
{% if badge_recommended %}
|
||||
<span class="collection-card__badge collection-card__badge--best">{{ 'collection_page.recommended' | t }}</span>
|
||||
{% endif %}
|
||||
{% if skin_label != blank %}
|
||||
<span class="collection-card__badge collection-card__badge--skin">{{ skin_label | escape }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if badge_mode != 'none' %}
|
||||
<div class="collection-card__badges">
|
||||
{% if badge_best %}
|
||||
<span class="collection-card__badge collection-card__badge--best">{{ 'bestsellers.badge' | t }}</span>
|
||||
{% endif %}
|
||||
{% if badge_recommended %}
|
||||
<span class="collection-card__badge collection-card__badge--best">{{ 'collection_page.recommended' | t }}</span>
|
||||
{% endif %}
|
||||
{% if badge_mode == 'collection' and collection_label != blank %}
|
||||
<span class="collection-card__badge collection-card__badge--skin">{{ collection_label | escape }}</span>
|
||||
{% elsif badge_mode == 'tags' and skin_label != blank %}
|
||||
<span class="collection-card__badge collection-card__badge--skin">{{ skin_label | escape }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<button
|
||||
class="collection-card__wish"
|
||||
@@ -211,7 +231,7 @@
|
||||
|
||||
document.addEventListener('click', (event) => {
|
||||
const wish = event.target.closest('.collection-card [data-wishlist]');
|
||||
if (!wish) return;
|
||||
if (!wish || wish.closest('[data-product-page]')) return;
|
||||
const id = String(wish.dataset.productId || '');
|
||||
const handle = String(wish.dataset.productHandle || '');
|
||||
if (!id) return;
|
||||
@@ -225,8 +245,10 @@
|
||||
});
|
||||
|
||||
document.addEventListener('submit', async (event) => {
|
||||
if (event.defaultPrevented) return;
|
||||
const form = event.target;
|
||||
if (!(form instanceof HTMLFormElement) || !form.hasAttribute('data-collection-card')) return;
|
||||
if (form.closest('[data-product-page]')) return;
|
||||
if (event.defaultPrevented) return;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
echo chunk
|
||||
else
|
||||
assign open_tag = chunk | split: '>' | first
|
||||
if open_tag contains 'application/json' or open_tag contains 'application/ld+json' or open_tag contains 'nolazy'
|
||||
if open_tag contains 'application/json' or open_tag contains 'application/ld+json' or open_tag contains 'nolazy' or chunk contains 'portable-wallets' or chunk contains 'shopify.dynamic_checkout'
|
||||
echo '<script'
|
||||
echo chunk
|
||||
elsif open_tag == blank
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{%- comment -%}
|
||||
Spanish label for Shopify-generated filter names/values (the store's default language is English).
|
||||
Usage: {% render 'facet-label', text: filter.label %}
|
||||
{%- endcomment -%}
|
||||
{%- assign facet_key = text | strip | downcase -%}
|
||||
{%- case facet_key -%}
|
||||
{%- when 'availability' -%}{{ 'facets.labels.availability' | t }}
|
||||
{%- when 'in stock' -%}{{ 'facets.labels.in_stock' | t }}
|
||||
{%- when 'out of stock' -%}{{ 'facets.labels.out_of_stock' | t }}
|
||||
{%- when 'price' -%}{{ 'facets.labels.price' | t }}
|
||||
{%- when 'product type' -%}{{ 'facets.labels.product_type' | t }}
|
||||
{%- when 'brand', 'vendor' -%}{{ 'facets.labels.brand' | t }}
|
||||
{%- when 'size' -%}{{ 'facets.labels.size' | t }}
|
||||
{%- when 'color', 'colour' -%}{{ 'facets.labels.color' | t }}
|
||||
{%- when 'tags', 'tag' -%}{{ 'facets.labels.tags' | t }}
|
||||
{%- when 'category' -%}{{ 'facets.labels.category' | t }}
|
||||
{%- when 'collection', 'collections' -%}{{ 'facets.labels.collection' | t }}
|
||||
{%- else -%}{{ text | escape }}
|
||||
{%- endcase -%}
|
||||
@@ -0,0 +1,222 @@
|
||||
{%- comment -%}
|
||||
Filters + sort toolbar (shared by collection and search pages). Wrap the page in [data-collection] for the JS.
|
||||
Params: filters, sort_options, current_sort, action_url, sort_action_url, clear_url, count_label, results_type, terms, tag_list, tag_base_url
|
||||
{%- endcomment -%}
|
||||
{%- liquid
|
||||
assign sort_label = blank
|
||||
for option in sort_options
|
||||
if option.value == current_sort
|
||||
capture sort_label
|
||||
render 'sort-label', value: option.value, fallback: option.name
|
||||
endcapture
|
||||
endif
|
||||
endfor
|
||||
-%}
|
||||
<div class="collection__bar">
|
||||
<div class="collection__tools">
|
||||
<button class="collection__tool" type="button" data-filter-toggle aria-expanded="false" aria-controls="facets-filters">
|
||||
<svg width="25" height="25" viewBox="0 0 25 25" aria-hidden="true" focusable="false">
|
||||
<path d="M4 7.5h17M4 12.5h17M4 17.5h17" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
|
||||
<circle cx="9" cy="7.5" r="2.1" fill="#f9f9fa" stroke="currentColor" stroke-width="1.4"/>
|
||||
<circle cx="16" cy="12.5" r="2.1" fill="#f9f9fa" stroke="currentColor" stroke-width="1.4"/>
|
||||
<circle cx="11" cy="17.5" r="2.1" fill="#f9f9fa" stroke="currentColor" stroke-width="1.4"/>
|
||||
</svg>
|
||||
{{ 'collection_page.filters' | t }}
|
||||
</button>
|
||||
<button class="collection__tool" type="button" data-sort-toggle aria-expanded="false" aria-controls="facets-sort">
|
||||
{%- if sort_label != blank -%}{{ 'collection_page.sort' | t: sort: sort_label }}{%- else -%}{{ 'collection_page.sort_title' | t }}{%- endif -%}
|
||||
</button>
|
||||
</div>
|
||||
{%- if count_label != blank -%}<p class="collection__count">{{ count_label }}</p>{%- endif -%}
|
||||
</div>
|
||||
|
||||
<div class="collection__drawer" id="facets-filters" data-filter-panel aria-hidden="true" inert>
|
||||
<button class="collection__drawer-backdrop" type="button" data-filter-close tabindex="-1" aria-label="{{ 'collection_page.close_filters' | t }}"></button>
|
||||
<div class="collection__drawer-panel" role="dialog" aria-modal="true" aria-labelledby="facets-filters-title">
|
||||
<div class="collection__drawer-head">
|
||||
<h2 id="facets-filters-title" class="collection__drawer-title">{{ 'collection_page.filters' | t }}</h2>
|
||||
<button class="collection__drawer-close" type="button" data-filter-close aria-label="{{ 'collection_page.close_filters' | t }}">
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true" focusable="false"><path d="M2 2l10 10M12 2L2 12" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
{%- if filters.size > 0 -%}
|
||||
<form class="collection__filter-form" action="{{ action_url }}" method="get">
|
||||
{%- if terms != blank -%}<input type="hidden" name="q" value="{{ terms | escape }}">{%- endif -%}
|
||||
{%- if results_type != blank -%}<input type="hidden" name="type" value="{{ results_type }}">{%- endif -%}
|
||||
{%- if current_sort != blank -%}<input type="hidden" name="sort_by" value="{{ current_sort }}">{%- endif -%}
|
||||
<div class="collection__filter-groups">
|
||||
{%- liquid
|
||||
assign native_tag_filter = false
|
||||
for filter in filters
|
||||
if filter.param_name contains 'tag'
|
||||
assign native_tag_filter = true
|
||||
endif
|
||||
endfor
|
||||
assign tag_options = ''
|
||||
if tag_list != blank and native_tag_filter == false
|
||||
assign hidden_tags = settings.facets_hidden_tags | downcase | split: ','
|
||||
assign seen_tags = '|'
|
||||
for tag in tag_list
|
||||
assign tag_lower = tag | downcase | strip
|
||||
assign tag_handle = tag | handleize
|
||||
assign tag_token = '|' | append: tag_handle | append: '|'
|
||||
assign skip_tag = false
|
||||
for hidden in hidden_tags
|
||||
assign hidden_clean = hidden | strip
|
||||
if hidden_clean != blank and hidden_clean == tag_lower
|
||||
assign skip_tag = true
|
||||
endif
|
||||
endfor
|
||||
if tag_lower contains '_'
|
||||
assign skip_tag = true
|
||||
endif
|
||||
if seen_tags contains tag_token
|
||||
assign skip_tag = true
|
||||
endif
|
||||
unless skip_tag
|
||||
assign seen_tags = seen_tags | append: tag_handle | append: '|'
|
||||
assign tag_options = tag_options | append: tag | append: '@@'
|
||||
endunless
|
||||
endfor
|
||||
endif
|
||||
-%}
|
||||
{%- for filter in filters -%}
|
||||
<fieldset class="collection__filter">
|
||||
<legend>{% render 'facet-label', text: filter.label %}</legend>
|
||||
{%- case filter.type -%}
|
||||
{%- when 'price_range' -%}
|
||||
<div class="collection__price">
|
||||
<input type="number" name="{{ filter.min_value.param_name }}" {% if filter.min_value.value %}value="{{ filter.min_value.value | divided_by: 100.0 }}"{% endif %} min="0" placeholder="0" aria-label="{{ 'facets.price_from' | t }}">
|
||||
<input type="number" name="{{ filter.max_value.param_name }}" {% if filter.max_value.value %}value="{{ filter.max_value.value | divided_by: 100.0 }}"{% endif %} min="0" placeholder="{{ filter.range_max | divided_by: 100.0 }}" aria-label="{{ 'facets.price_to' | t }}">
|
||||
</div>
|
||||
{%- else -%}
|
||||
<div class="collection__options">
|
||||
{%- for value in filter.values -%}
|
||||
<label class="collection__option">
|
||||
<input type="checkbox" name="{{ value.param_name }}" value="{{ value.value }}" {% if value.active %}checked{% endif %} {% if value.count == 0 and value.active == false %}disabled{% endif %}>
|
||||
<span>{% render 'facet-label', text: value.label %} ({{ value.count }})</span>
|
||||
</label>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
{%- endcase -%}
|
||||
</fieldset>
|
||||
{%- endfor -%}
|
||||
{%- if tag_options != blank -%}
|
||||
{%- assign active_tags = '|' -%}
|
||||
{%- for t in current_tags -%}{%- assign t_handle = t | handleize -%}{%- assign active_tags = active_tags | append: t_handle | append: '|' -%}{%- endfor -%}
|
||||
<fieldset class="collection__filter" data-tag-filter data-base-url="{{ tag_base_url }}">
|
||||
<legend>{{ 'facets.labels.tags' | t }}</legend>
|
||||
<div class="collection__options">
|
||||
{%- assign tag_array = tag_options | split: '@@' -%}
|
||||
{%- for tag in tag_array -%}
|
||||
{%- assign tag_handle = tag | handleize -%}
|
||||
{%- assign tag_token = '|' | append: tag_handle | append: '|' -%}
|
||||
<label class="collection__option">
|
||||
<input type="checkbox" data-tag value="{{ tag_handle }}" {% if active_tags contains tag_token %}checked{% endif %}>
|
||||
<span>{{ tag | capitalize | escape }}</span>
|
||||
</label>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</fieldset>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
<div class="collection__filter-actions">
|
||||
<button class="collection__apply" type="submit">{{ 'collection_page.apply' | t }}</button>
|
||||
<a class="collection__clear" href="{{ clear_url }}">{{ 'collection_page.clear' | t }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{%- else -%}
|
||||
<p class="collection__none">{{ 'collection_page.no_filters' | t }}</p>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="collection__drawer" id="facets-sort" data-sort-panel aria-hidden="true" inert>
|
||||
<button class="collection__drawer-backdrop" type="button" data-sort-close tabindex="-1" aria-label="{{ 'collection_page.close_sort' | t }}"></button>
|
||||
<div class="collection__drawer-panel" role="dialog" aria-modal="true" aria-labelledby="facets-sort-title">
|
||||
<div class="collection__drawer-head">
|
||||
<h2 id="facets-sort-title" class="collection__drawer-title">{{ 'collection_page.sort_title' | t }}</h2>
|
||||
<button class="collection__drawer-close" type="button" data-sort-close aria-label="{{ 'collection_page.close_sort' | t }}">
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true" focusable="false"><path d="M2 2l10 10M12 2L2 12" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<form class="collection__sort-form" action="{{ sort_action_url | default: action_url }}" method="get">
|
||||
{%- if terms != blank -%}<input type="hidden" name="q" value="{{ terms | escape }}">{%- endif -%}
|
||||
{%- if results_type != blank -%}<input type="hidden" name="type" value="{{ results_type }}">{%- endif -%}
|
||||
{%- for filter in filters -%}
|
||||
{%- if filter.type == 'price_range' -%}
|
||||
{%- if filter.min_value.value -%}<input type="hidden" name="{{ filter.min_value.param_name }}" value="{{ filter.min_value.value | divided_by: 100.0 }}">{%- endif -%}
|
||||
{%- if filter.max_value.value -%}<input type="hidden" name="{{ filter.max_value.param_name }}" value="{{ filter.max_value.value | divided_by: 100.0 }}">{%- endif -%}
|
||||
{%- else -%}
|
||||
{%- for value in filter.active_values -%}<input type="hidden" name="{{ value.param_name }}" value="{{ value.value }}">{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
<div class="collection__sort-list">
|
||||
{%- for option in sort_options -%}
|
||||
<button class="collection__sort-option{% if option.value == current_sort %} is-current{% endif %}" type="submit" name="sort_by" value="{{ option.value }}">{% render 'sort-label', value: option.value, fallback: option.name %}</button>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script nolazy>
|
||||
(function () {
|
||||
// Shared drawer logic for collection + search. Takes over the collection section's handler.
|
||||
if (window.__seasonFacets) return;
|
||||
window.__seasonFacets = true;
|
||||
window.__seasonCollection = true;
|
||||
|
||||
var ids = { filter: 'facets-filters', sort: 'facets-sort' };
|
||||
var portal = function () {
|
||||
// Drawers live inside animated sections (transform) which breaks position:fixed; move them to <body>.
|
||||
Object.keys(ids).forEach(function (k) {
|
||||
var el = document.getElementById(ids[k]);
|
||||
if (el && el.parentElement !== document.body) document.body.appendChild(el);
|
||||
});
|
||||
};
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', portal); else portal();
|
||||
|
||||
var setPanel = function (name, open) {
|
||||
var panel = document.getElementById(ids[name]);
|
||||
var button = document.querySelector('[data-' + name + '-toggle]');
|
||||
if (!panel) return;
|
||||
panel.classList.toggle('is-open', open);
|
||||
panel.setAttribute('aria-hidden', open ? 'false' : 'true');
|
||||
panel.inert = !open;
|
||||
if (button) button.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||
document.documentElement.classList.toggle('overflow-hidden', !!document.querySelector('.collection__drawer.is-open'));
|
||||
if (open) { var close = panel.querySelector('.collection__drawer-close'); if (close) close.focus(); }
|
||||
};
|
||||
|
||||
document.addEventListener('click', function (event) {
|
||||
var t = event.target;
|
||||
if (t.closest('[data-filter-close]')) { setPanel('filter', false); return; }
|
||||
if (t.closest('[data-sort-close]')) { setPanel('sort', false); return; }
|
||||
if (t.closest('[data-filter-toggle]')) {
|
||||
var f = document.getElementById(ids.filter);
|
||||
setPanel('sort', false); setPanel('filter', !(f && f.classList.contains('is-open'))); return;
|
||||
}
|
||||
if (t.closest('[data-sort-toggle]')) {
|
||||
var s = document.getElementById(ids.sort);
|
||||
setPanel('filter', false); setPanel('sort', !(s && s.classList.contains('is-open')));
|
||||
}
|
||||
});
|
||||
document.addEventListener('submit', function (event) {
|
||||
var form = event.target;
|
||||
if (!form.classList || !form.classList.contains('collection__filter-form')) return;
|
||||
// Keep URLs clean: drop empty price inputs.
|
||||
[].slice.call(form.querySelectorAll('input[type="number"]')).forEach(function (i) { i.disabled = i.value === ''; });
|
||||
window.setTimeout(function () { [].slice.call(form.querySelectorAll('input[type="number"]')).forEach(function (i) { i.disabled = false; }); }, 0);
|
||||
var group = form.querySelector('[data-tag-filter]');
|
||||
if (!group) return;
|
||||
var tags = [].slice.call(group.querySelectorAll('[data-tag]:checked')).map(function (i) { return i.value; });
|
||||
var base = group.getAttribute('data-base-url');
|
||||
form.setAttribute('action', tags.length ? base + '/' + tags.join('+') : base);
|
||||
}, true);
|
||||
document.addEventListener('keydown', function (event) {
|
||||
if (event.key !== 'Escape') return;
|
||||
setPanel('filter', false); setPanel('sort', false);
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
@@ -0,0 +1,34 @@
|
||||
{%- comment -%}
|
||||
Google Customer Reviews badge (seller rating). Loads on the first user interaction
|
||||
so it doesn't affect initial page performance. Configure in Theme settings › Google Customer Reviews.
|
||||
{%- endcomment -%}
|
||||
{%- if settings.gcr_badge_enabled and settings.gcr_merchant_id != blank -%}
|
||||
{%- unless request.design_mode -%}
|
||||
<script nolazy>
|
||||
(function () {
|
||||
var CFG = {
|
||||
merchant_id: {{ settings.gcr_merchant_id | strip | plus: 0 }},
|
||||
position: {{ settings.gcr_badge_position | default: 'BOTTOM_LEFT' | json }},
|
||||
region: {{ settings.gcr_region | default: 'MX' | upcase | json }}
|
||||
};
|
||||
var EVENTS = ['scroll', 'touchstart', 'pointerdown', 'mousemove', 'keydown', 'wheel'];
|
||||
var done = false;
|
||||
function inject() {
|
||||
var s = document.createElement('script');
|
||||
s.id = 'merchantWidgetScript';
|
||||
s.src = 'https://www.gstatic.com/shopping/merchant/merchantwidget.js';
|
||||
s.defer = true;
|
||||
s.setAttribute('nolazy', '');
|
||||
s.onload = function () { if (window.merchantwidget) window.merchantwidget.start(CFG); };
|
||||
document.body.appendChild(s);
|
||||
}
|
||||
function go() {
|
||||
if (done) return; done = true;
|
||||
EVENTS.forEach(function (ev) { window.removeEventListener(ev, go, { passive: true }); });
|
||||
if (document.readyState === 'complete') inject(); else window.addEventListener('load', inject, { once: true });
|
||||
}
|
||||
EVENTS.forEach(function (ev) { window.addEventListener(ev, go, { passive: true }); });
|
||||
})();
|
||||
</script>
|
||||
{%- endunless -%}
|
||||
{%- endif -%}
|
||||
@@ -297,6 +297,30 @@
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% if cards %}
|
||||
<button
|
||||
type="button"
|
||||
class="header__submenu-arrow header__submenu-arrow--prev"
|
||||
data-submenu-scroll="-1"
|
||||
hidden
|
||||
aria-label="{{ 'header.submenu_prev' | t }}"
|
||||
>
|
||||
<svg width="8" height="14" viewBox="0 0 8 14" aria-hidden="true" focusable="false">
|
||||
<path d="M1 1.2 6.8 7 1 12.8" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="header__submenu-arrow header__submenu-arrow--next"
|
||||
data-submenu-scroll="1"
|
||||
hidden
|
||||
aria-label="{{ 'header.submenu_next' | t }}"
|
||||
>
|
||||
<svg width="8" height="14" viewBox="0 0 8 14" aria-hidden="true" focusable="false">
|
||||
<path d="M1 1.2 6.8 7 1 12.8" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% elsif show_caret %}
|
||||
<span class="header__icon header__icon--caret" aria-hidden="true">
|
||||
{{ 'icon-caret-down.svg' | inline_asset_content }}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{% doc %}
|
||||
Compact inline tag shown only on subscription lines: "Suscripción · cada 1 mes".
|
||||
Rendered inline (inside the price line) so it never adds height to the row.
|
||||
Full plan name in the title/aria label. One-time purchases get no tag.
|
||||
|
||||
@param {object} item - Cart line item
|
||||
|
||||
@example
|
||||
{% render 'line-purchase-type', item: item %}
|
||||
{% enddoc %}
|
||||
{%- if item.selling_plan_allocation -%}
|
||||
{%- assign plan_name = item.selling_plan_allocation.selling_plan.name -%}
|
||||
{%- assign plan_short = plan_name | split: '(' | first | strip | remove: 'Entrega ' | remove: 'entrega ' -%}
|
||||
<span class="line-purchase line-purchase--sub" title="{{ plan_name | escape }}" aria-label="{{ 'cart_drawer.subscription' | t }}: {{ plan_name | escape }}">
|
||||
<svg width="10" height="10" viewBox="0 0 12 12" aria-hidden="true" focusable="false"><path d="M10 4.5A4.2 4.2 0 0 0 2.4 3.4M2 7.5a4.2 4.2 0 0 0 7.6 1.1M2.2 1.5v2.2h2.2M9.8 10.5V8.3H7.6" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||
<span aria-hidden="true">{{ 'cart_drawer.subscription' | t }}<span class="line-purchase__detail"> · {{ plan_short | escape }}</span></span>
|
||||
</span>
|
||||
{%- endif -%}
|
||||
@@ -66,9 +66,7 @@
|
||||
{%- endif -%}
|
||||
|
||||
{%- if request.page_type == 'product' -%}
|
||||
<script type="application/ld+json">
|
||||
{{ product | structured_data }}
|
||||
</script>
|
||||
{%- render 'product-structured-data', product: product -%}
|
||||
|
||||
<meta
|
||||
property="og:price:amount"
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
{% doc %}
|
||||
Prints the category collection for a product badge.
|
||||
Matches the product type to its catalog collection, such as Hidratantes or Sérum,
|
||||
and skips skin labels such as Piel madura.
|
||||
|
||||
@param {product} product - Product whose collection is printed
|
||||
|
||||
@example
|
||||
{% render 'product-collection-label', product: product %}
|
||||
{% enddoc %}
|
||||
{% liquid
|
||||
assign type_handle = product.type | handleize
|
||||
assign wanted = type_handle
|
||||
if type_handle == 'proteccion-solar'
|
||||
assign wanted = 'proteccion-solar-1'
|
||||
endif
|
||||
if type_handle == 'kit' or type_handle == 'kits'
|
||||
assign wanted = 'kits-skincare-facial'
|
||||
endif
|
||||
|
||||
assign label = blank
|
||||
if wanted != blank
|
||||
for collection_item in product.collections
|
||||
if collection_item.handle == wanted
|
||||
assign label = collection_item.title
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if label == blank and wanted != blank
|
||||
for collection_item in product.collections
|
||||
if collection_item.handle contains wanted
|
||||
assign label = collection_item.title
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if label == blank and product.type != blank
|
||||
assign label = product.type | capitalize
|
||||
endif
|
||||
%}
|
||||
{{- label -}}
|
||||
@@ -0,0 +1,112 @@
|
||||
{%- comment -%}
|
||||
Product JSON-LD for Google rich results / merchant listings.
|
||||
Adds aggregateRating (reviews.* metafields), shippingDetails and hasMerchantReturnPolicy
|
||||
(theme settings › SEO) on top of the data Shopify's structured_data filter provides.
|
||||
{%- endcomment -%}
|
||||
{%- liquid
|
||||
assign currency = cart.currency.iso_code
|
||||
assign country = settings.sd_ship_country | default: 'MX' | upcase
|
||||
assign ship_cost = settings.sd_ship_cost | default: 0
|
||||
assign free_from = settings.sd_free_threshold | default: 0 | times: 100
|
||||
assign product_url = request.origin | append: product.url
|
||||
assign current = product.selected_or_first_available_variant
|
||||
assign rating_count = product.metafields.reviews.rating_count.value | default: 0 | plus: 0
|
||||
assign rating_value = product.metafields.reviews.rating.value.rating | default: 0
|
||||
assign rating_best = product.metafields.reviews.rating.value.scale_max | default: 5
|
||||
assign rating_worst = product.metafields.reviews.rating.value.scale_min | default: 1
|
||||
assign brand = product.vendor | default: shop.name
|
||||
-%}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Product",
|
||||
"@id": {{ product_url | append: '#product' | json }},
|
||||
"url": {{ product_url | json }},
|
||||
"name": {{ product.title | json }},
|
||||
"description": {{ product.description | strip_html | strip | truncate: 5000 | json }},
|
||||
{%- if product.media.size > 0 %}
|
||||
"image": [
|
||||
{%- assign img_n = 0 -%}
|
||||
{%- for media in product.media -%}
|
||||
{%- if media.preview_image and img_n < 6 -%}
|
||||
{%- if img_n > 0 %},{% endif -%}
|
||||
{{ media.preview_image | image_url: width: 1920 | prepend: 'https:' | json }}
|
||||
{%- assign img_n = img_n | plus: 1 -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
],
|
||||
{%- endif %}
|
||||
"brand": { "@type": "Brand", "name": {{ brand | json }} },
|
||||
{%- if product.type != blank %}
|
||||
"category": {{ product.type | json }},
|
||||
{%- endif %}
|
||||
{%- if current.sku != blank %}
|
||||
"sku": {{ current.sku | json }},
|
||||
{%- endif %}
|
||||
{%- if rating_count > 0 and rating_value != 0 %}
|
||||
"aggregateRating": {
|
||||
"@type": "AggregateRating",
|
||||
"ratingValue": {{ rating_value | json }},
|
||||
"bestRating": {{ rating_best | json }},
|
||||
"worstRating": {{ rating_worst | json }},
|
||||
"ratingCount": {{ rating_count }},
|
||||
"reviewCount": {{ rating_count }}
|
||||
},
|
||||
{%- endif %}
|
||||
"offers": [
|
||||
{%- for variant in product.variants -%}
|
||||
{%- liquid
|
||||
assign v_price = variant.price | divided_by: 100.0
|
||||
assign v_rate = ship_cost
|
||||
if free_from > 0 and variant.price >= free_from
|
||||
assign v_rate = 0
|
||||
endif
|
||||
assign gtin_len = variant.barcode | size
|
||||
-%}
|
||||
{
|
||||
"@type": "Offer",
|
||||
"@id": {{ product_url | append: '?variant=' | append: variant.id | append: '#offer' | json }},
|
||||
"url": {{ product_url | append: '?variant=' | append: variant.id | json }},
|
||||
{%- if variant.sku != blank %}
|
||||
"sku": {{ variant.sku | json }},
|
||||
{%- endif %}
|
||||
{%- if variant.barcode != blank and gtin_len >= 8 and gtin_len <= 14 %}
|
||||
"gtin": {{ variant.barcode | json }},
|
||||
{%- endif %}
|
||||
{%- unless product.has_only_default_variant %}
|
||||
"name": {{ product.title | append: ' - ' | append: variant.title | json }},
|
||||
{%- endunless %}
|
||||
"price": {{ v_price | round: 2 | json }},
|
||||
"priceCurrency": {{ currency | json }},
|
||||
"itemCondition": "https://schema.org/NewCondition",
|
||||
"availability": "https://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
|
||||
"seller": { "@type": "Organization", "name": {{ shop.name | json }} },
|
||||
"shippingDetails": {
|
||||
"@type": "OfferShippingDetails",
|
||||
"shippingRate": { "@type": "MonetaryAmount", "value": {{ v_rate | json }}, "currency": {{ currency | json }} },
|
||||
"shippingDestination": { "@type": "DefinedRegion", "addressCountry": {{ country | json }} },
|
||||
"deliveryTime": {
|
||||
"@type": "ShippingDeliveryTime",
|
||||
"handlingTime": { "@type": "QuantitativeValue", "minValue": {{ settings.sd_handling_min | default: 1 }}, "maxValue": {{ settings.sd_handling_max | default: 2 }}, "unitCode": "DAY" },
|
||||
"transitTime": { "@type": "QuantitativeValue", "minValue": {{ settings.sd_transit_min | default: 3 }}, "maxValue": {{ settings.sd_transit_max | default: 5 }}, "unitCode": "DAY" }
|
||||
}
|
||||
},
|
||||
"hasMerchantReturnPolicy": {
|
||||
"@type": "MerchantReturnPolicy",
|
||||
"applicableCountry": {{ country | json }},
|
||||
{%- if settings.sd_returns %}
|
||||
"returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
|
||||
"merchantReturnDays": {{ settings.sd_return_days | default: 5 }},
|
||||
"returnMethod": "https://schema.org/ReturnByMail",
|
||||
"refundType": "https://schema.org/{{ settings.sd_refund_type | default: 'ExchangeRefund' }}",
|
||||
"returnFees": "https://schema.org/{{ settings.sd_return_fees | default: 'FreeReturn' }}",
|
||||
"merchantReturnLink": {{ request.origin | append: '/policies/refund-policy' | json }}
|
||||
{%- else %}
|
||||
"returnPolicyCategory": "https://schema.org/MerchantReturnNotPermitted"
|
||||
{%- endif %}
|
||||
}
|
||||
}{% unless forloop.last %},{% endunless %}
|
||||
{%- endfor %}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
@@ -16,8 +16,22 @@
|
||||
return type === 'application/json' || type === 'application/ld+json' || type === 'rocketlazyloadscript';
|
||||
};
|
||||
|
||||
const keepCheckout = (script) => {
|
||||
const src = (script.getAttribute('src') || '').toLowerCase();
|
||||
const attribution = script.getAttribute('data-source-attribution') || '';
|
||||
const code = script.textContent || '';
|
||||
if (src.includes('portable-wallets') || attribution.includes('shopify.dynamic_checkout') || code.includes('portable-wallets') || code.includes('shopify.dynamic_checkout')) return true;
|
||||
// Wallet SDKs read their own script URL (PayPal needs client-id). Delaying them
|
||||
// strips src and the button is removed before the shopper can click it.
|
||||
return src.includes('paypal.com')
|
||||
|| src.includes('paypalobjects.com')
|
||||
|| src.includes('pay.google.com')
|
||||
|| src.includes('payments.google.com')
|
||||
|| src.includes('applepay.cdn-apple.com');
|
||||
};
|
||||
|
||||
const holdScript = (script) => {
|
||||
if (exemptScript(script)) return;
|
||||
if (exemptScript(script) || keepCheckout(script)) return;
|
||||
const src = script.getAttribute('src');
|
||||
if (src) {
|
||||
script.setAttribute('data-rocket-src', src);
|
||||
@@ -29,8 +43,22 @@
|
||||
script.setAttribute('type', 'rocketlazyloadscript');
|
||||
};
|
||||
|
||||
// App-embed stylesheets (cdn.shopify.com/extensions/...) are injected in <body> and block
|
||||
// rendering; their widgets sit below the fold, so load them without blocking.
|
||||
const softenStyle = (link) => {
|
||||
if (link.tagName !== 'LINK' || link.rel !== 'stylesheet' || link.dataset.soft) return;
|
||||
const href = link.getAttribute('href') || '';
|
||||
if (!(link.hasAttribute('data-app-id') || href.indexOf('/extensions/') !== -1)) return;
|
||||
link.dataset.soft = '1';
|
||||
const media = link.media && link.media !== 'print' ? link.media : 'all';
|
||||
link.media = 'print';
|
||||
const done = () => { link.media = media; };
|
||||
if (link.sheet) done(); else link.addEventListener('load', done, { once: true });
|
||||
};
|
||||
|
||||
const holdTree = (node) => {
|
||||
if (!node || node.nodeType !== 1) return;
|
||||
softenStyle(node);
|
||||
holdScript(node);
|
||||
if (node.querySelectorAll) node.querySelectorAll('script').forEach(holdScript);
|
||||
};
|
||||
@@ -79,6 +107,15 @@
|
||||
|
||||
_onTouchStart(event) {
|
||||
if (event.target.tagName === 'HTML') return;
|
||||
// Native controls (checkboxes, labels, inputs, plain links) and UI handled by
|
||||
// non-delayed scripts work without the delayed bundle: never hold their clicks.
|
||||
const target = event.target.closest ? event.target : event.target.parentElement;
|
||||
if (target && target.closest && target.closest(
|
||||
'input, label, select, textarea, summary, option, [contenteditable], [data-no-intercept],'
|
||||
+ ' [data-filter-toggle], [data-sort-toggle], [data-filter-close], [data-sort-close],'
|
||||
+ ' .collection__drawer, [data-learn] .learn__media, .product__excerpt-toggle, .edge-arrow,'
|
||||
+ ' a[href]:not([href^="#"]):not([data-cart-open]):not([data-wish-open]):not([role="button"])'
|
||||
)) return;
|
||||
window.addEventListener('touchend', this.touchEndHandler);
|
||||
window.addEventListener('mouseup', this.touchEndHandler);
|
||||
window.addEventListener('touchmove', this.touchMoveHandler, { passive: true });
|
||||
@@ -119,7 +156,15 @@
|
||||
window.removeEventListener('touchstart', this.touchStartHandler, { passive: true });
|
||||
window.removeEventListener('mousedown', this.touchStartHandler);
|
||||
this.interceptedClicks.forEach((event) => {
|
||||
event.target.dispatchEvent(new MouseEvent('click', { view: event.view, bubbles: true, cancelable: true }));
|
||||
const target = event.target;
|
||||
const control = target && target.closest ? target.closest('button, input') : null;
|
||||
if (control && control.type === 'submit' && control.form && !control.disabled && typeof control.form.requestSubmit === 'function') {
|
||||
control.form.requestSubmit(control);
|
||||
return;
|
||||
}
|
||||
if (target && typeof target.dispatchEvent === 'function') {
|
||||
target.dispatchEvent(new MouseEvent('click', { view: event.view, bubbles: true, cancelable: true }));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{%- comment -%}
|
||||
Spanish label for a Shopify sort value. Usage: {% render 'sort-label', value: option.value, fallback: option.name %}
|
||||
{%- endcomment -%}
|
||||
{%- case value -%}
|
||||
{%- when 'manual' -%}{{ 'facets.sort.manual' | t }}
|
||||
{%- when 'most-relevant', 'relevance' -%}{{ 'facets.sort.relevance' | t }}
|
||||
{%- when 'best-selling' -%}{{ 'facets.sort.best_selling' | t }}
|
||||
{%- when 'title-ascending' -%}{{ 'facets.sort.title_ascending' | t }}
|
||||
{%- when 'title-descending' -%}{{ 'facets.sort.title_descending' | t }}
|
||||
{%- when 'price-ascending' -%}{{ 'facets.sort.price_ascending' | t }}
|
||||
{%- when 'price-descending' -%}{{ 'facets.sort.price_descending' | t }}
|
||||
{%- when 'created-ascending' -%}{{ 'facets.sort.created_ascending' | t }}
|
||||
{%- when 'created-descending' -%}{{ 'facets.sort.created_descending' | t }}
|
||||
{%- else -%}{{ fallback | escape }}
|
||||
{%- endcase -%}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user