{{ 'collection_page.recent' | t }}

{% if collection != blank %} {% for product in collection.products limit: 4 %} {% assign card_suffix = section.id | append: '-recent-' | append: forloop.index %} {% render 'collection-card', product: product, form_suffix: card_suffix %} {% endfor %} {% endif %}
{% stylesheet %} .recent { background: #f9f9fa; color: #000; } .recent__inner { padding: 10px 100px 80px; } .recent__title { margin: 0 0 24px; font-size: 20px; font-weight: 500; letter-spacing: 0.04em; line-height: normal; text-transform: uppercase; } .recent__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 20px; } @media (max-width: 1119px) { .recent__inner { padding-right: 24px; padding-left: 24px; } .recent__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } } @media (max-width: 767px) { .recent__inner { padding: 8px 10px 48px; } .recent__title { margin-bottom: 16px; font-size: 16px; } } {% endstylesheet %} {% javascript %} (() => { if (window.__seasonRecent) return; window.__seasonRecent = true; const storageKey = 'seasons-recent'; const boot = async (root) => { if (!root || root.dataset.ready === 'true') return; root.dataset.ready = 'true'; let handles = []; try { const stored = JSON.parse(window.localStorage.getItem(storageKey)); if (Array.isArray(stored)) handles = stored.map(String).filter(Boolean); } catch (error) { handles = []; } handles = handles.slice(0, 4); const list = root.querySelector('[data-recent-list]'); if (!list) return; if (handles.length) { const prefix = `${root.dataset.root || '/'}`.replace(/\/?$/, '/'); const cards = await Promise.all(handles.map(async (handle) => { try { const response = await fetch(`${prefix}products/${encodeURIComponent(handle)}?view=card`, { headers: { Accept: 'text/html' } }); if (!response.ok) return null; const holder = document.createElement('div'); holder.innerHTML = (await response.text()).trim(); return holder.querySelector('.collection-card'); } catch (error) { return null; } })); const ready = cards.filter(Boolean); if (ready.length) list.replaceChildren(...ready); } root.hidden = list.children.length === 0; }; document.querySelectorAll('[data-recent]').forEach(boot); })(); {% endjavascript %} {% schema %} { "name": "t:collection_page.recent_name", "tag": "section", "class": "recent-section", "settings": [] } {% endschema %}