{%- comment -%} Bundle and Look, by Your Elevens (yourelevens.com) One section, two layouts: "Shop the look" (a photo with numbered pins) and "Bundle" (cards with a total). Works on any Online Store 2.0 theme: no theme code is touched, styles are scoped to this section, and "Add all" uses the standard cart API. Drop this file into /sections and add it from the theme editor. {%- endcomment -%} {%- liquid assign layout = section.settings.layout assign cur = cart.currency.iso_code assign sid = section.id -%} {%- style -%} #ye-{{ sid }} { --ye-bg: {{ section.settings.bg }}; --ye-tx: {{ section.settings.text }}; --ye-ac: {{ section.settings.accent }}; --ye-acx: {{ section.settings.accent_text }}; --ye-ln: color-mix(in srgb, {{ section.settings.text }} 14%, transparent); background: var(--ye-bg); color: var(--ye-tx); padding: {{ section.settings.pad_top }}px 0 {{ section.settings.pad_bottom }}px; font-family: inherit; } #ye-{{ sid }} * { box-sizing: border-box; } #ye-{{ sid }} .ye-wrap { max-width: {{ section.settings.max_width }}px; margin: 0 auto; padding: 0 20px; } #ye-{{ sid }} .ye-head { margin-bottom: 28px; max-width: 640px; } #ye-{{ sid }} .ye-head h2 { margin: 0; font-size: clamp(26px, 4vw, 40px); line-height: 1.1; color: inherit; } #ye-{{ sid }} .ye-head p { margin: 10px 0 0; opacity: .75; } #ye-{{ sid }} .ye-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; } #ye-{{ sid }}.ye-bundle .ye-grid { grid-template-columns: 1fr; } #ye-{{ sid }} .ye-stage { position: relative; background: color-mix(in srgb, var(--ye-tx) 6%, transparent); aspect-ratio: 4 / 5; overflow: hidden; border-radius: {{ section.settings.radius }}px; } #ye-{{ sid }} .ye-stage img, #ye-{{ sid }} .ye-stage svg { width: 100%; height: 100%; object-fit: cover; display: block; } #ye-{{ sid }} .ye-stage { overflow: visible; } #ye-{{ sid }} .ye-stage > img, #ye-{{ sid }} .ye-stage > svg { border-radius: {{ section.settings.radius }}px; } #ye-{{ sid }} .ye-pin { position: absolute; transform: translate(-50%, -50%); z-index: 2; } #ye-{{ sid }} .ye-pb { position: relative; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ye-bg); background: var(--ye-ac); color: var(--ye-acx); font-family: inherit; font-weight: 600; font-size: 13px; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: 0 3px 12px rgba(0,0,0,.35); padding: 0; transition: transform .2s; } #ye-{{ sid }} .ye-pb::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 1.5px solid var(--ye-ac); opacity: .65; animation: ye-pulse-{{ sid }} 2.4s ease-out infinite; } #ye-{{ sid }} .ye-pin:hover .ye-pb, #ye-{{ sid }} .ye-pin.is-on .ye-pb { transform: scale(1.2); } #ye-{{ sid }} .ye-pin.is-off .ye-pb { background: var(--ye-bg); color: var(--ye-tx); } #ye-{{ sid }} .ye-pin.is-off .ye-pb::after { display: none; } @keyframes ye-pulse-{{ sid }} { from { transform: scale(.7); opacity: .8; } to { transform: scale(1.6); opacity: 0; } } #ye-{{ sid }} .ye-tip { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translate(-50%, 6px); width: 210px; background: var(--ye-bg); color: var(--ye-tx); border: 1px solid var(--ye-ln); border-radius: {{ section.settings.radius }}px; padding: 10px; display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 14px 40px rgba(0,0,0,.25); z-index: 5; } #ye-{{ sid }} .ye-pin.ye-l .ye-tip { left: 0; transform: translate(-14px, 6px); } #ye-{{ sid }} .ye-pin.ye-r .ye-tip { left: auto; right: 0; transform: translate(14px, 6px); } #ye-{{ sid }} .ye-pin:hover .ye-tip, #ye-{{ sid }} .ye-pin:focus-within .ye-tip, #ye-{{ sid }} .ye-pin.is-tip .ye-tip { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); } #ye-{{ sid }} .ye-pin.ye-l:hover .ye-tip, #ye-{{ sid }} .ye-pin.ye-l:focus-within .ye-tip, #ye-{{ sid }} .ye-pin.ye-l.is-tip .ye-tip { transform: translate(-14px, 0); } #ye-{{ sid }} .ye-pin.ye-r:hover .ye-tip, #ye-{{ sid }} .ye-pin.ye-r:focus-within .ye-tip, #ye-{{ sid }} .ye-pin.ye-r.is-tip .ye-tip { transform: translate(14px, 0); } #ye-{{ sid }} .ye-tip img, #ye-{{ sid }} .ye-tip .ye-ph { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; } #ye-{{ sid }} .ye-tip b { display: block; font-size: 13px; font-weight: 600; } #ye-{{ sid }} .ye-tip span { font-size: 12.5px; opacity: .7; } #ye-{{ sid }} .ye-tt { display: block; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--ye-tx); font-family: inherit; font-weight: 600; font-size: 11.5px; text-decoration: underline; cursor: pointer; text-align: left; } #ye-{{ sid }} .ye-item.is-hl { background: color-mix(in srgb, var(--ye-ac) 8%, transparent); } #ye-{{ sid }} .ye-btn.is-done { background: var(--ye-tx); color: var(--ye-bg); } @media (prefers-reduced-motion: reduce) { #ye-{{ sid }} .ye-pb::after { animation: none; } } #ye-{{ sid }} .ye-list { display: grid; gap: 12px; } #ye-{{ sid }}.ye-bundle .ye-list { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } #ye-{{ sid }} .ye-item { display: grid; grid-template-columns: 22px 76px 1fr; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--ye-ln); border-radius: {{ section.settings.radius }}px; transition: border-color .2s, opacity .2s; } #ye-{{ sid }} .ye-item.is-on { border-color: var(--ye-ac); } #ye-{{ sid }} .ye-item.is-off { opacity: .5; } #ye-{{ sid }}.ye-bundle .ye-item { grid-template-columns: 1fr; text-align: center; padding: 16px; position: relative; } #ye-{{ sid }}.ye-bundle .ye-item .ye-n { display: none; } #ye-{{ sid }} .ye-item img, #ye-{{ sid }} .ye-ph { width: 76px; aspect-ratio: 1; object-fit: cover; border-radius: {{ section.settings.radius }}px; background: color-mix(in srgb, var(--ye-tx) 8%, transparent); } #ye-{{ sid }}.ye-bundle .ye-item img, #ye-{{ sid }}.ye-bundle .ye-ph { width: 100%; aspect-ratio: 1; } #ye-{{ sid }} .ye-n { width: 22px; height: 22px; border-radius: 50%; background: var(--ye-ac); color: var(--ye-acx); font: 600 12px/22px inherit; text-align: center; } #ye-{{ sid }} .ye-t { font-weight: 600; font-size: 15px; display: block; color: inherit; } #ye-{{ sid }} .ye-p { font-size: 14px; opacity: .8; margin-top: 2px; } #ye-{{ sid }} .ye-p s { opacity: .6; margin-right: 6px; } #ye-{{ sid }} .ye-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; } #ye-{{ sid }}.ye-bundle .ye-row { justify-content: center; } #ye-{{ sid }} select { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--ye-ln); border-radius: 6px; background: var(--ye-bg); color: var(--ye-tx); max-width: 100%; } #ye-{{ sid }} label.ye-inc { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; } #ye-{{ sid }} input[type=checkbox] { accent-color: var(--ye-ac); width: 16px; height: 16px; margin: 0; } #ye-{{ sid }} .ye-bar { margin-top: 20px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; border: 1px solid var(--ye-ln); border-radius: {{ section.settings.radius }}px; } #ye-{{ sid }} .ye-sum { font-size: 14px; } #ye-{{ sid }} .ye-sum b { font-size: 22px; display: block; } #ye-{{ sid }} .ye-save { display: inline-block; margin-left: 8px; font-size: 12px; background: var(--ye-ac); color: var(--ye-acx); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; vertical-align: middle; } #ye-{{ sid }} .ye-btn { appearance: none; border: 0; cursor: pointer; background: var(--ye-ac); color: var(--ye-acx); font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1; padding: 15px 26px; border-radius: {{ section.settings.radius }}px; min-width: 200px; } #ye-{{ sid }} .ye-btn[disabled] { opacity: .5; cursor: not-allowed; } #ye-{{ sid }} .ye-msg { margin-top: 10px; font-size: 14px; min-height: 20px; } #ye-{{ sid }} .ye-plus { display: none; } @media (max-width: 800px) { #ye-{{ sid }} .ye-grid { grid-template-columns: 1fr; gap: 20px; } #ye-{{ sid }} .ye-btn { width: 100%; } } {%- endstyle -%} {%- if section.settings.heading != blank or section.settings.subheading != blank -%} {%- if section.settings.heading != blank -%}{{ section.settings.heading | escape }}{%- endif -%} {%- if section.settings.subheading != blank -%}{{ section.settings.subheading | escape }}{%- endif -%} {%- endif -%} {%- if layout == 'look' -%} {%- if section.settings.image != blank -%} {{ section.settings.image | image_url: width: 1200 | image_tag: loading: 'lazy', widths: '480, 720, 960, 1200', sizes: '(min-width: 800px) 50vw, 100vw', alt: section.settings.heading }} {%- elsif section.settings.image_url != blank -%} {%- else -%} {{ 'lifestyle-1' | placeholder_svg_tag }} {%- endif -%} {%- assign n = 0 -%} {%- for block in section.blocks -%} {%- if block.settings.product != blank -%} {%- assign n = n | plus: 1 -%} {%- assign pp = block.settings.product -%} {%- liquid assign side = '' if block.settings.pin_x < 36 assign side = 'ye-l' elsif block.settings.pin_x > 64 assign side = 'ye-r' endif -%} {{ n }} {%- if pp.featured_image -%}{{ pp.featured_image | image_url: width: 120 | image_tag: loading: 'lazy', width: 52, height: 52, alt: '' }}{%- else -%}{%- endif -%} {{ block.settings.label | default: pp.title | escape }}{{ pp.selected_or_first_available_variant.price | money }}Remove from look {%- endif -%} {%- endfor -%} {%- endif -%} {%- assign n = 0 -%} {%- for block in section.blocks -%} {%- assign p = block.settings.product -%} {%- if p != blank -%} {%- assign n = n | plus: 1 -%} {%- assign first = p.selected_or_first_available_variant -%} {{ n }} {%- if p.featured_image -%} {{ p.featured_image | image_url: width: 600 | image_tag: loading: 'lazy', widths: '160, 240, 400, 600', sizes: '(min-width: 800px) 300px, 160px', alt: p.title }} {%- else -%} {%- endif -%} {{ block.settings.label | default: p.title | escape }} {%- if first.compare_at_price > first.price -%}{{ first.compare_at_price | money }}{%- endif -%} {{ first.price | money }} {%- if p.has_only_default_variant == false and p.available -%} {%- for v in p.variants -%} {{ v.title | escape }}{% unless v.available %} (sold out){% endunless %} {%- endfor -%} {%- else -%} {%- endif -%} {%- if p.available -%} Include {%- else -%} Sold out {%- endif -%} {%- endif -%} {%- endfor -%} {{ section.settings.button_label | escape }} {% schema %} { "name": "Bundle and Look", "tag": "section", "class": "ye-wrapper", "max_blocks": 8, "settings": [ { "type": "header", "content": "Layout" }, { "type": "select", "id": "layout", "label": "Style", "default": "look", "options": [ { "value": "look", "label": "Shop the look (photo with pins)" }, { "value": "bundle", "label": "Bundle (product cards)" } ] }, { "type": "text", "id": "heading", "label": "Heading", "default": "Shop the look" }, { "type": "textarea", "id": "subheading", "label": "Text", "default": "Tap a pin to see each piece, then add the whole look in one go." }, { "type": "image_picker", "id": "image", "label": "Look photo (Shop the look only)", "info": "Portrait 4:5 works best. Add products as blocks, then set each pin's position." }, { "type": "text", "id": "image_url", "label": "Or paste an image address", "info": "Use this if the photo is hosted somewhere else. The picker above wins if both are set." }, { "type": "header", "content": "Add all button" }, { "type": "text", "id": "button_label", "label": "Button label", "default": "Add the look to bag" }, { "type": "select", "id": "after_add", "label": "After adding", "default": "cart", "options": [ { "value": "cart", "label": "Go to the cart" }, { "value": "checkout", "label": "Go to checkout" }, { "value": "stay", "label": "Stay on the page" } ] }, { "type": "header", "content": "Bundle discount" }, { "type": "range", "id": "discount_percent", "label": "Percent shown as saved", "min": 0, "max": 40, "step": 1, "unit": "%", "default": 0, "info": "Display only. Create an automatic or code discount in Shopify Discounts so the price really drops." }, { "type": "text", "id": "save_label", "label": "Savings label", "default": "Bundle price" }, { "type": "text", "id": "discount_code", "label": "Discount code to apply (optional)", "info": "Applied automatically after Add all, using Shopify's /discount link." }, { "type": "header", "content": "Colours" }, { "type": "color", "id": "bg", "label": "Background", "default": "#ffffff" }, { "type": "color", "id": "text", "label": "Text", "default": "#111111" }, { "type": "color", "id": "accent", "label": "Accent", "default": "#111111" }, { "type": "color", "id": "accent_text", "label": "Text on accent", "default": "#ffffff" }, { "type": "header", "content": "Spacing and shape" }, { "type": "range", "id": "radius", "label": "Corner radius", "min": 0, "max": 24, "step": 2, "unit": "px", "default": 8 }, { "type": "range", "id": "max_width", "label": "Maximum width", "min": 900, "max": 1600, "step": 50, "unit": "px", "default": 1200 }, { "type": "range", "id": "pad_top", "label": "Top padding", "min": 0, "max": 120, "step": 4, "unit": "px", "default": 56 }, { "type": "range", "id": "pad_bottom", "label": "Bottom padding", "min": 0, "max": 120, "step": 4, "unit": "px", "default": 56 } ], "blocks": [ { "type": "item", "name": "Product", "settings": [ { "type": "product", "id": "product", "label": "Product" }, { "type": "text", "id": "label", "label": "Custom name (optional)" }, { "type": "range", "id": "pin_x", "label": "Pin: left to right", "min": 0, "max": 100, "step": 1, "unit": "%", "default": 50 }, { "type": "range", "id": "pin_y", "label": "Pin: top to bottom", "min": 0, "max": 100, "step": 1, "unit": "%", "default": 50 }, { "type": "checkbox", "id": "preselected", "label": "Ticked by default", "default": true } ] } ], "presets": [ { "name": "Bundle and Look", "blocks": [ { "type": "item" }, { "type": "item" }, { "type": "item" } ] } ] } {% endschema %}
{{ section.settings.subheading | escape }}