{"title":"Estuches regalo personalizados","description":"","products":[{"product_id":"estuche-regalo-personalizado-3-botellas","title":"Estuche regalo personalizado - 3 botellas","description":"\u003cdiv class=\"vipejar-estuche-config\" data-estuche-title=\"Estuche regalo personalizado - 3 botellas\" data-estuche-size=\"3\" data-estuche-variant-id=\"54140934259029\" data-estuche-price=\"4.5\"\u003e\n  \u003cstyle\u003e\n    .vipejar-estuche-config { margin: 22px 0; padding: 22px; border: 1px solid #e5ded4; background: #fffaf2; color: #241b16; }\n    .vipejar-estuche-config * { box-sizing: border-box; }\n    .veg-kicker { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8b6234; }\n    .veg-title { margin: 0 0 10px; font-size: 24px; line-height: 1.18; color: #241b16; }\n    .veg-copy { margin: 0 0 16px; color: #5b4b3f; line-height: 1.55; }\n    .veg-fields { display: grid; gap: 12px; margin: 18px 0; }\n    .veg-field span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: #3b2c22; }\n    .veg-select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #d7c9b8; background: #fff; color: #241b16; font-size: 15px; }\n    .veg-summary { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 16px 0; padding: 14px; background: #fff; border: 1px solid #eadfce; }\n    .veg-summary strong { display: block; font-size: 20px; color: #241b16; }\n    .veg-note { margin: 0; font-size: 13px; color: #6b5a4d; }\n    .veg-button { min-height: 46px; padding: 12px 18px; border: 0; background: #2f241d; color: #fff; font-weight: 700; cursor: pointer; }\n    .veg-button:disabled { opacity: .55; cursor: not-allowed; }\n    .veg-message { margin: 10px 0 0; font-size: 14px; color: #7b2f20; }\n    .veg-help { margin: 14px 0 0; padding-left: 18px; color: #5b4b3f; line-height: 1.5; }\n    @media (max-width: 640px) { .vipejar-estuche-config { padding: 18px 14px; } .veg-title { font-size: 21px; } .veg-button { width: 100%; } }\n  \u003c\/style\u003e\n  \u003cp class=\"veg-kicker\"\u003eConfigura tu estuche\u003c\/p\u003e\n  \u003ch2 class=\"veg-title\"\u003eElige las 3 botellas\u003c\/h2\u003e\n  \u003cp class=\"veg-copy\"\u003eCombina tres vinos de nuestra tienda y prepara un regalo personalizado. El carrito añadirá el estuche y las botellas seleccionadas con su precio real y una nota para prepararlas juntas.\u003c\/p\u003e\n  \u003cdiv class=\"veg-fields\"\u003e\n\u003clabel class=\"veg-field\"\u003e\u003cspan\u003eBotella 1\u003c\/span\u003e\u003cselect class=\"veg-select\" data-slot=\"1\" required\u003e\u003coption value=\"\"\u003eElige una botella\u003c\/option\u003e\u003c\/select\u003e\u003c\/label\u003e\u003clabel class=\"veg-field\"\u003e\u003cspan\u003eBotella 2\u003c\/span\u003e\u003cselect class=\"veg-select\" data-slot=\"2\" required\u003e\u003coption value=\"\"\u003eElige una botella\u003c\/option\u003e\u003c\/select\u003e\u003c\/label\u003e\u003clabel class=\"veg-field\"\u003e\u003cspan\u003eBotella 3\u003c\/span\u003e\u003cselect class=\"veg-select\" data-slot=\"3\" required\u003e\u003coption value=\"\"\u003eElige una botella\u003c\/option\u003e\u003c\/select\u003e\u003c\/label\u003e\n\u003c\/div\u003e\n  \u003cdiv class=\"veg-summary\"\u003e\n    \u003cdiv\u003e\n\u003cspan\u003eTotal estuche + botellas\u003c\/span\u003e\u003cstrong class=\"veg-total\"\u003e4,50 EUR\u003c\/strong\u003e\u003cp class=\"veg-note\"\u003eIncluye estuche de 3 botellas: 4,50 EUR.\u003c\/p\u003e\n\u003c\/div\u003e\n    \u003cbutton type=\"button\" class=\"veg-button\" disabled\u003eAñadir estuche al carrito\u003c\/button\u003e\n  \u003c\/div\u003e\n  \u003cp class=\"veg-message\" aria-live=\"polite\"\u003e\u003c\/p\u003e\n  \u003cul class=\"veg-help\"\u003e\n    \u003cli\u003eSi quieres repetir una botella, puedes seleccionarla en más de una posición.\u003c\/li\u003e\n    \u003cli\u003eSi necesitas ayuda para combinar vinos, escríbenos por WhatsApp antes de finalizar.\u003c\/li\u003e\n  \u003c\/ul\u003e\n  \u003cscript type=\"application\/json\" class=\"veg-data\"\u003e[{\"title\":\"Terras Gauda\",\"variantId\":54140948414805,\"price\":15.8,\"priceText\":\"15,80 EUR\",\"type\":\"Blanco\",\"handle\":\"terras-gauda\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f6c105541b57f7f40b2854full.png?v=1781519242\"},{\"title\":\"Castell D´Ordall Semi Seco Rosado\",\"variantId\":54140939895125,\"price\":4.5,\"priceText\":\"4,50 EUR\",\"type\":\"Cava\",\"handle\":\"castell-d-ordall-semi-seco-rosado\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/ORDAL.png?v=1781519982\"},{\"title\":\"1900 Campo Delle More\",\"variantId\":54140938387797,\"price\":10.9,\"priceText\":\"10,90 EUR\",\"type\":\"Espumoso\",\"handle\":\"1900-campo-delle-more\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f6b6466b3c3349710b4e32medium.jpg?v=1781520026\"},{\"title\":\"Agnus Tinto de Autor Crianza\",\"variantId\":54140951691605,\"price\":12,\"priceText\":\"12,00 EUR\",\"type\":\"Tinto\",\"handle\":\"agnus-tinto-de-autor-crianza\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f69d4654a534ba1202b1abfull.png?v=1781517812\"},{\"title\":\"Agnus Tinto de Autor Tempranillo\",\"variantId\":54140952183125,\"price\":8,\"priceText\":\"8,00 EUR\",\"type\":\"Tinto\",\"handle\":\"agnus-tinto-de-autor-cosecha\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f69d8ca69cbfeb7a045e9dfull.png?v=1781518417\"},{\"title\":\"La Baraja\",\"variantId\":54140951232853,\"price\":35,\"priceText\":\"35,00 EUR\",\"type\":\"Tinto\",\"handle\":\"la-baraja\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f693533ce66cde2f0d9b76full.png?v=1781518677\"},{\"title\":\"Matarromera Crianza\",\"variantId\":54140944253269,\"price\":25.6,\"priceText\":\"25,60 EUR\",\"type\":\"Tinto\",\"handle\":\"matarromera-crianza\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/64a6c8de9976906e770499e1medium.png?v=1781519736\"},{\"title\":\"Pago de Carraovejas\",\"variantId\":54140950380885,\"price\":40.5,\"priceText\":\"40,50 EUR\",\"type\":\"Tinto\",\"handle\":\"pago-de-carraovejas\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/671b46eb00a98765ed00dec8full.png?v=1781518818\"},{\"title\":\"Terra Incognita\",\"variantId\":54140950872405,\"price\":25,\"priceText\":\"25,00 EUR\",\"type\":\"Tinto\",\"handle\":\"terra-incognita\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/terraincognita.jpg?v=1781517307\"},{\"title\":\"Vilano Black\",\"variantId\":54140953887061,\"price\":8.5,\"priceText\":\"8,50 EUR\",\"type\":\"Tinto\",\"handle\":\"vilano-black\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f6918431355a5b250dbe29full_9f7bf6d2-ca6c-45a6-b264-2e368e27d987.png?v=1781517873\"},{\"title\":\"La Madre Red\",\"variantId\":54140937634133,\"price\":7,\"priceText\":\"7,00 EUR\",\"type\":\"Vermut\",\"handle\":\"la-madre-red\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f6adb65f73e6697d056f5cmedium.png?v=1781520127\"},{\"title\":\"La Madre White\",\"variantId\":54140937109845,\"price\":7,\"priceText\":\"7,00 EUR\",\"type\":\"Vermut\",\"handle\":\"la-madre-white\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/lamadre.png?v=1781520289\"}]\u003c\/script\u003e\n  \u003cscript\u003e\n  (function() {\n    var root = document.currentScript.closest('.vipejar-estuche-config');\n    if (!root || root.dataset.ready === 'stable-20260712') return;\n    root.dataset.ready = 'stable-20260712';\n    var dataNode = root.querySelector('.veg-data');\n    var wines = [];\n    try { wines = JSON.parse(dataNode ? dataNode.textContent : '[]'); } catch (error) {}\n    var estucheTitle = root.getAttribute('data-estuche-title') || 'Estuche regalo personalizado';\n    var size = Number(root.getAttribute('data-estuche-size') || 0);\n    var estucheVariantId = Number(root.getAttribute('data-estuche-variant-id') || 0);\n    var estuchePrice = Number(root.getAttribute('data-estuche-price') || 0);\n    var lastState = '';\n    function money(value) { return value.toFixed(2).replace('.', ',') + ' EUR'; }\n    function label(wine) { return wine.title + ' - ' + wine.type + ' - ' + wine.priceText; }\n    function getSelects() { return Array.prototype.slice.call(root.querySelectorAll('.veg-select')); }\n    function getButton() { return root.querySelector('.veg-button'); }\n    function getMessage() { return root.querySelector('.veg-message'); }\n    function getTotal() { return root.querySelector('.veg-total'); }\n    function fillOptions() {\n      getSelects().forEach(function(select) {\n        if (select.options.length \u003e 1) return;\n        wines.forEach(function(wine) {\n          var option = document.createElement('option');\n          option.value = String(wine.variantId);\n          option.textContent = label(wine);\n          option.dataset.title = wine.title;\n          option.dataset.price = String(wine.price);\n          select.appendChild(option);\n        });\n      });\n    }\n    function selectedOptions() {\n      return getSelects().map(function(select) { return select.options[select.selectedIndex]; }).filter(function(option) { return option \u0026\u0026 option.value; });\n    }\n    function refresh() {\n      var selected = selectedOptions();\n      var sum = estuchePrice + selected.reduce(function(acc, option) { return acc + Number(option.dataset.price || 0); }, 0);\n      var totalText = money(sum);\n      var disabled = selected.length !== size;\n      var messageText = selected.length \u0026\u0026 selected.length !== size ? 'Selecciona las ' + size + ' botellas para poder añadir el estuche.' : '';\n      var state = totalText + '|' + disabled + '|' + messageText;\n      if (state === lastState) return;\n      lastState = state;\n      var total = getTotal();\n      var button = getButton();\n      var message = getMessage();\n      if (total \u0026\u0026 total.textContent !== totalText) total.textContent = totalText;\n      if (button \u0026\u0026 button.disabled !== disabled) button.disabled = disabled;\n      if (message \u0026\u0026 message.textContent !== messageText) message.textContent = messageText;\n    }\n    root.addEventListener('change', function(event) {\n      if (event.target \u0026\u0026 event.target.classList.contains('veg-select')) refresh();\n    });\n    root.addEventListener('click', function(event) {\n      var button = event.target \u0026\u0026 event.target.closest('.veg-button');\n      if (!button || button.disabled) return;\n      var selected = selectedOptions();\n      if (selected.length !== size) { refresh(); return; }\n      var message = getMessage();\n      var items = [{\n        id: estucheVariantId,\n        quantity: 1,\n        properties: {\n          'Estuche': estucheTitle,\n          'Preparar como regalo': 'Si'\n        }\n      }].concat(selected.map(function(option, index) {\n        return {\n          id: Number(option.value),\n          quantity: 1,\n          properties: {\n            'Estuche': estucheTitle,\n            'Botella': String(index + 1) + ' de ' + size,\n            'Preparar como regalo': 'Si'\n          }\n        };\n      }));\n      button.disabled = true;\n      button.textContent = 'Añadiendo...';\n      if (message) message.textContent = '';\n      fetch('\/cart\/add.js', {\n        method: 'POST',\n        headers: { 'Content-Type': 'application\/json', 'Accept': 'application\/json' },\n        body: JSON.stringify({ items: items })\n      })\n      .then(function(res) { if (!res.ok) throw new Error('No se pudo añadir al carrito'); return res.json(); })\n      .then(function() { window.location.href = '\/cart'; })\n      .catch(function() {\n        if (message) message.textContent = 'No se ha podido añadir. Revisa que las botellas sigan disponibles o contacta por WhatsApp.';\n      })\n      .finally(function() {\n        button.textContent = 'Añadir estuche al carrito';\n        lastState = '';\n        refresh();\n      });\n    });\n    fillOptions();\n    refresh();\n    setTimeout(refresh, 250);\n    setTimeout(refresh, 900);\n  })();\n  \u003c\/script\u003e\n\u003c\/div\u003e\n\n\u003cscript id=\"vpEstucheMobileMove20260623\"\u003e(function(){if(window.__vpEstucheMobileMove20260623)return;window.__vpEstucheMobileMove20260623=1;function isPage(){return \/\\\/products\\\/estuche-regalo-personalizado-[23]-botellas\/.test(location.pathname)}function money(n){return Number(n||0).toFixed(2).replace('.',',')+' EUR'}function cfg(){return document.querySelector('.vipejar-estuche-config')}function chosen(root){return Array.prototype.slice.call(root.querySelectorAll('.veg-select')).map(function(s){return s.options[s.selectedIndex]}).filter(function(o){return o\u0026\u0026o.value})}function recalc(root){if(!root)return;var size=+root.getAttribute('data-estuche-size')||0,total=+root.getAttribute('data-estuche-price')||0,opts=chosen(root),btn=root.querySelector('.veg-button'),msg=root.querySelector('.veg-message'),out=root.querySelector('.veg-total');opts.forEach(function(o){total+=+(o.getAttribute('data-price')||0)});if(out)out.textContent=money(total);if(btn)btn.disabled=opts.length!==size;if(msg)msg.textContent=opts.length\u0026\u0026opts.length!==size?'Selecciona las '+size+' botellas para poder aÃ±adir el estuche.':''}function makeVisible(root){root.removeAttribute('hidden');root.setAttribute('data-vp-mobile-visible','1');root.style.setProperty('display','block','important');root.style.setProperty('visibility','visible','important');root.style.setProperty('opacity','1','important');root.style.setProperty('height','auto','important');root.style.setProperty('min-height','0','important');root.style.setProperty('overflow','visible','important');root.querySelectorAll('.veg-select,.veg-button').forEach(function(el){el.style.setProperty('display','block','important');el.style.setProperty('visibility','visible','important');el.style.setProperty('opacity','1','important');el.style.setProperty('min-height','44px','important')})}function place(){if(!isPage())return;var root=cfg();if(!root||!root.querySelector('.veg-select'))return;var area=document.querySelector('.product-page-info')||document.querySelector('main')||document.body;var rect=root.getBoundingClientRect();if(!area.contains(root)||rect.height\u003c40||rect.width\u003c40){var anchor=area.querySelector('.product-page-info__details')||area.querySelector('.vp-trust-strip')||area.querySelector('.product-page-info__title')||area.firstElementChild;if(anchor\u0026\u0026anchor.parentNode)anchor.parentNode.insertBefore(root,anchor.nextSibling);else area.appendChild(root)}makeVisible(root);document.querySelectorAll('.footbar-product,.js-product-button-add-to-cart:not(.veg-button),.cowlendar-btn:not(.veg-button)').forEach(function(el){el.style.setProperty('display','none','important')});recalc(root)}document.addEventListener('change',function(e){var root=e.target\u0026\u0026e.target.closest\u0026\u0026e.target.closest('.vipejar-estuche-config');if(root)recalc(root)},true);document.addEventListener('click',function(e){var root=e.target\u0026\u0026e.target.closest\u0026\u0026e.target.closest('.vipejar-estuche-config');if(root)setTimeout(function(){recalc(root)},0)},true);document.readyState==='loading'?document.addEventListener('DOMContentLoaded',place):place();window.addEventListener('load',place);document.addEventListener('shopify:section:load',place);[250,800,1600,3000,5000].forEach(function(t){setTimeout(place,t)});try{new MutationObserver(place).observe(document.documentElement,{childList:true,subtree:true})}catch(e){}})();\u003c\/script\u003e\n","brand":"Vipejar Distribuciones","offers":[{"title":"Default Title","offer_id":54140934259029,"sku":"ESTUCHE-REGALO-PERSONALIZADO-3-BOTELLAS","price":4.5,"currency_code":"EUR","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/vipejar-estuche-3-botellas-real.jpg?v=1781541669"},{"product_id":"estuche-regalo-personalizado-2-botellas","title":"Estuche regalo personalizado - 2 botellas","description":"\u003cdiv class=\"vipejar-estuche-config\" data-estuche-title=\"Estuche regalo personalizado - 2 botellas\" data-estuche-size=\"2\" data-estuche-variant-id=\"54140935110997\" data-estuche-price=\"3.5\"\u003e\n  \u003cstyle\u003e\n    .vipejar-estuche-config { margin: 22px 0; padding: 22px; border: 1px solid #e5ded4; background: #fffaf2; color: #241b16; }\n    .vipejar-estuche-config * { box-sizing: border-box; }\n    .veg-kicker { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8b6234; }\n    .veg-title { margin: 0 0 10px; font-size: 24px; line-height: 1.18; color: #241b16; }\n    .veg-copy { margin: 0 0 16px; color: #5b4b3f; line-height: 1.55; }\n    .veg-fields { display: grid; gap: 12px; margin: 18px 0; }\n    .veg-field span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: #3b2c22; }\n    .veg-select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #d7c9b8; background: #fff; color: #241b16; font-size: 15px; }\n    .veg-summary { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 16px 0; padding: 14px; background: #fff; border: 1px solid #eadfce; }\n    .veg-summary strong { display: block; font-size: 20px; color: #241b16; }\n    .veg-note { margin: 0; font-size: 13px; color: #6b5a4d; }\n    .veg-button { min-height: 46px; padding: 12px 18px; border: 0; background: #2f241d; color: #fff; font-weight: 700; cursor: pointer; }\n    .veg-button:disabled { opacity: .55; cursor: not-allowed; }\n    .veg-message { margin: 10px 0 0; font-size: 14px; color: #7b2f20; }\n    .veg-help { margin: 14px 0 0; padding-left: 18px; color: #5b4b3f; line-height: 1.5; }\n    @media (max-width: 640px) { .vipejar-estuche-config { padding: 18px 14px; } .veg-title { font-size: 21px; } .veg-button { width: 100%; } }\n  \u003c\/style\u003e\n  \u003cp class=\"veg-kicker\"\u003eConfigura tu estuche\u003c\/p\u003e\n  \u003ch2 class=\"veg-title\"\u003eElige las 2 botellas\u003c\/h2\u003e\n  \u003cp class=\"veg-copy\"\u003eCombina dos vinos de nuestra tienda y prepara un regalo personalizado. El carrito añadirá el estuche y las botellas seleccionadas con su precio real y una nota para prepararlas juntas.\u003c\/p\u003e\n  \u003cdiv class=\"veg-fields\"\u003e\n\u003clabel class=\"veg-field\"\u003e\u003cspan\u003eBotella 1\u003c\/span\u003e\u003cselect class=\"veg-select\" data-slot=\"1\" required\u003e\u003coption value=\"\"\u003eElige una botella\u003c\/option\u003e\u003c\/select\u003e\u003c\/label\u003e\u003clabel class=\"veg-field\"\u003e\u003cspan\u003eBotella 2\u003c\/span\u003e\u003cselect class=\"veg-select\" data-slot=\"2\" required\u003e\u003coption value=\"\"\u003eElige una botella\u003c\/option\u003e\u003c\/select\u003e\u003c\/label\u003e\n\u003c\/div\u003e\n  \u003cdiv class=\"veg-summary\"\u003e\n    \u003cdiv\u003e\n\u003cspan\u003eTotal estuche + botellas\u003c\/span\u003e\u003cstrong class=\"veg-total\"\u003e3,50 EUR\u003c\/strong\u003e\u003cp class=\"veg-note\"\u003eIncluye estuche de 2 botellas: 3,50 EUR.\u003c\/p\u003e\n\u003c\/div\u003e\n    \u003cbutton type=\"button\" class=\"veg-button\" disabled\u003eAñadir estuche al carrito\u003c\/button\u003e\n  \u003c\/div\u003e\n  \u003cp class=\"veg-message\" aria-live=\"polite\"\u003e\u003c\/p\u003e\n  \u003cul class=\"veg-help\"\u003e\n    \u003cli\u003eSi quieres repetir una botella, puedes seleccionarla en más de una posición.\u003c\/li\u003e\n    \u003cli\u003eSi necesitas ayuda para combinar vinos, escríbenos por WhatsApp antes de finalizar.\u003c\/li\u003e\n  \u003c\/ul\u003e\n  \u003cscript type=\"application\/json\" class=\"veg-data\"\u003e[{\"title\":\"Terras Gauda\",\"variantId\":54140948414805,\"price\":15.8,\"priceText\":\"15,80 EUR\",\"type\":\"Blanco\",\"handle\":\"terras-gauda\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f6c105541b57f7f40b2854full.png?v=1781519242\"},{\"title\":\"Castell D´Ordall Semi Seco Rosado\",\"variantId\":54140939895125,\"price\":4.5,\"priceText\":\"4,50 EUR\",\"type\":\"Cava\",\"handle\":\"castell-d-ordall-semi-seco-rosado\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/ORDAL.png?v=1781519982\"},{\"title\":\"1900 Campo Delle More\",\"variantId\":54140938387797,\"price\":10.9,\"priceText\":\"10,90 EUR\",\"type\":\"Espumoso\",\"handle\":\"1900-campo-delle-more\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f6b6466b3c3349710b4e32medium.jpg?v=1781520026\"},{\"title\":\"Agnus Tinto de Autor Crianza\",\"variantId\":54140951691605,\"price\":12,\"priceText\":\"12,00 EUR\",\"type\":\"Tinto\",\"handle\":\"agnus-tinto-de-autor-crianza\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f69d4654a534ba1202b1abfull.png?v=1781517812\"},{\"title\":\"Agnus Tinto de Autor Tempranillo\",\"variantId\":54140952183125,\"price\":8,\"priceText\":\"8,00 EUR\",\"type\":\"Tinto\",\"handle\":\"agnus-tinto-de-autor-cosecha\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f69d8ca69cbfeb7a045e9dfull.png?v=1781518417\"},{\"title\":\"La Baraja\",\"variantId\":54140951232853,\"price\":35,\"priceText\":\"35,00 EUR\",\"type\":\"Tinto\",\"handle\":\"la-baraja\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f693533ce66cde2f0d9b76full.png?v=1781518677\"},{\"title\":\"Matarromera Crianza\",\"variantId\":54140944253269,\"price\":25.6,\"priceText\":\"25,60 EUR\",\"type\":\"Tinto\",\"handle\":\"matarromera-crianza\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/64a6c8de9976906e770499e1medium.png?v=1781519736\"},{\"title\":\"Pago de Carraovejas\",\"variantId\":54140950380885,\"price\":40.5,\"priceText\":\"40,50 EUR\",\"type\":\"Tinto\",\"handle\":\"pago-de-carraovejas\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/671b46eb00a98765ed00dec8full.png?v=1781518818\"},{\"title\":\"Terra Incognita\",\"variantId\":54140950872405,\"price\":25,\"priceText\":\"25,00 EUR\",\"type\":\"Tinto\",\"handle\":\"terra-incognita\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/terraincognita.jpg?v=1781517307\"},{\"title\":\"Vilano Black\",\"variantId\":54140953887061,\"price\":8.5,\"priceText\":\"8,50 EUR\",\"type\":\"Tinto\",\"handle\":\"vilano-black\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f6918431355a5b250dbe29full_9f7bf6d2-ca6c-45a6-b264-2e368e27d987.png?v=1781517873\"},{\"title\":\"La Madre Red\",\"variantId\":54140937634133,\"price\":7,\"priceText\":\"7,00 EUR\",\"type\":\"Vermut\",\"handle\":\"la-madre-red\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/67f6adb65f73e6697d056f5cmedium.png?v=1781520127\"},{\"title\":\"La Madre White\",\"variantId\":54140937109845,\"price\":7,\"priceText\":\"7,00 EUR\",\"type\":\"Vermut\",\"handle\":\"la-madre-white\",\"image\":\"https:\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/lamadre.png?v=1781520289\"}]\u003c\/script\u003e\n  \u003cscript\u003e\n  (function() {\n    var root = document.currentScript.closest('.vipejar-estuche-config');\n    if (!root || root.dataset.ready === 'stable-20260712') return;\n    root.dataset.ready = 'stable-20260712';\n    var dataNode = root.querySelector('.veg-data');\n    var wines = [];\n    try { wines = JSON.parse(dataNode ? dataNode.textContent : '[]'); } catch (error) {}\n    var estucheTitle = root.getAttribute('data-estuche-title') || 'Estuche regalo personalizado';\n    var size = Number(root.getAttribute('data-estuche-size') || 0);\n    var estucheVariantId = Number(root.getAttribute('data-estuche-variant-id') || 0);\n    var estuchePrice = Number(root.getAttribute('data-estuche-price') || 0);\n    var lastState = '';\n    function money(value) { return value.toFixed(2).replace('.', ',') + ' EUR'; }\n    function label(wine) { return wine.title + ' - ' + wine.type + ' - ' + wine.priceText; }\n    function getSelects() { return Array.prototype.slice.call(root.querySelectorAll('.veg-select')); }\n    function getButton() { return root.querySelector('.veg-button'); }\n    function getMessage() { return root.querySelector('.veg-message'); }\n    function getTotal() { return root.querySelector('.veg-total'); }\n    function fillOptions() {\n      getSelects().forEach(function(select) {\n        if (select.options.length \u003e 1) return;\n        wines.forEach(function(wine) {\n          var option = document.createElement('option');\n          option.value = String(wine.variantId);\n          option.textContent = label(wine);\n          option.dataset.title = wine.title;\n          option.dataset.price = String(wine.price);\n          select.appendChild(option);\n        });\n      });\n    }\n    function selectedOptions() {\n      return getSelects().map(function(select) { return select.options[select.selectedIndex]; }).filter(function(option) { return option \u0026\u0026 option.value; });\n    }\n    function refresh() {\n      var selected = selectedOptions();\n      var sum = estuchePrice + selected.reduce(function(acc, option) { return acc + Number(option.dataset.price || 0); }, 0);\n      var totalText = money(sum);\n      var disabled = selected.length !== size;\n      var messageText = selected.length \u0026\u0026 selected.length !== size ? 'Selecciona las ' + size + ' botellas para poder añadir el estuche.' : '';\n      var state = totalText + '|' + disabled + '|' + messageText;\n      if (state === lastState) return;\n      lastState = state;\n      var total = getTotal();\n      var button = getButton();\n      var message = getMessage();\n      if (total \u0026\u0026 total.textContent !== totalText) total.textContent = totalText;\n      if (button \u0026\u0026 button.disabled !== disabled) button.disabled = disabled;\n      if (message \u0026\u0026 message.textContent !== messageText) message.textContent = messageText;\n    }\n    root.addEventListener('change', function(event) {\n      if (event.target \u0026\u0026 event.target.classList.contains('veg-select')) refresh();\n    });\n    root.addEventListener('click', function(event) {\n      var button = event.target \u0026\u0026 event.target.closest('.veg-button');\n      if (!button || button.disabled) return;\n      var selected = selectedOptions();\n      if (selected.length !== size) { refresh(); return; }\n      var message = getMessage();\n      var items = [{\n        id: estucheVariantId,\n        quantity: 1,\n        properties: {\n          'Estuche': estucheTitle,\n          'Preparar como regalo': 'Si'\n        }\n      }].concat(selected.map(function(option, index) {\n        return {\n          id: Number(option.value),\n          quantity: 1,\n          properties: {\n            'Estuche': estucheTitle,\n            'Botella': String(index + 1) + ' de ' + size,\n            'Preparar como regalo': 'Si'\n          }\n        };\n      }));\n      button.disabled = true;\n      button.textContent = 'Añadiendo...';\n      if (message) message.textContent = '';\n      fetch('\/cart\/add.js', {\n        method: 'POST',\n        headers: { 'Content-Type': 'application\/json', 'Accept': 'application\/json' },\n        body: JSON.stringify({ items: items })\n      })\n      .then(function(res) { if (!res.ok) throw new Error('No se pudo añadir al carrito'); return res.json(); })\n      .then(function() { window.location.href = '\/cart'; })\n      .catch(function() {\n        if (message) message.textContent = 'No se ha podido añadir. Revisa que las botellas sigan disponibles o contacta por WhatsApp.';\n      })\n      .finally(function() {\n        button.textContent = 'Añadir estuche al carrito';\n        lastState = '';\n        refresh();\n      });\n    });\n    fillOptions();\n    refresh();\n    setTimeout(refresh, 250);\n    setTimeout(refresh, 900);\n  })();\n  \u003c\/script\u003e\n\u003c\/div\u003e\n\n\u003cscript id=\"vpEstucheMobileMove20260623\"\u003e(function(){if(window.__vpEstucheMobileMove20260623)return;window.__vpEstucheMobileMove20260623=1;function isPage(){return \/\\\/products\\\/estuche-regalo-personalizado-[23]-botellas\/.test(location.pathname)}function money(n){return Number(n||0).toFixed(2).replace('.',',')+' EUR'}function cfg(){return document.querySelector('.vipejar-estuche-config')}function chosen(root){return Array.prototype.slice.call(root.querySelectorAll('.veg-select')).map(function(s){return s.options[s.selectedIndex]}).filter(function(o){return o\u0026\u0026o.value})}function recalc(root){if(!root)return;var size=+root.getAttribute('data-estuche-size')||0,total=+root.getAttribute('data-estuche-price')||0,opts=chosen(root),btn=root.querySelector('.veg-button'),msg=root.querySelector('.veg-message'),out=root.querySelector('.veg-total');opts.forEach(function(o){total+=+(o.getAttribute('data-price')||0)});if(out)out.textContent=money(total);if(btn)btn.disabled=opts.length!==size;if(msg)msg.textContent=opts.length\u0026\u0026opts.length!==size?'Selecciona las '+size+' botellas para poder aÃ±adir el estuche.':''}function makeVisible(root){root.removeAttribute('hidden');root.setAttribute('data-vp-mobile-visible','1');root.style.setProperty('display','block','important');root.style.setProperty('visibility','visible','important');root.style.setProperty('opacity','1','important');root.style.setProperty('height','auto','important');root.style.setProperty('min-height','0','important');root.style.setProperty('overflow','visible','important');root.querySelectorAll('.veg-select,.veg-button').forEach(function(el){el.style.setProperty('display','block','important');el.style.setProperty('visibility','visible','important');el.style.setProperty('opacity','1','important');el.style.setProperty('min-height','44px','important')})}function place(){if(!isPage())return;var root=cfg();if(!root||!root.querySelector('.veg-select'))return;var area=document.querySelector('.product-page-info')||document.querySelector('main')||document.body;var rect=root.getBoundingClientRect();if(!area.contains(root)||rect.height\u003c40||rect.width\u003c40){var anchor=area.querySelector('.product-page-info__details')||area.querySelector('.vp-trust-strip')||area.querySelector('.product-page-info__title')||area.firstElementChild;if(anchor\u0026\u0026anchor.parentNode)anchor.parentNode.insertBefore(root,anchor.nextSibling);else area.appendChild(root)}makeVisible(root);document.querySelectorAll('.footbar-product,.js-product-button-add-to-cart:not(.veg-button),.cowlendar-btn:not(.veg-button)').forEach(function(el){el.style.setProperty('display','none','important')});recalc(root)}document.addEventListener('change',function(e){var root=e.target\u0026\u0026e.target.closest\u0026\u0026e.target.closest('.vipejar-estuche-config');if(root)recalc(root)},true);document.addEventListener('click',function(e){var root=e.target\u0026\u0026e.target.closest\u0026\u0026e.target.closest('.vipejar-estuche-config');if(root)setTimeout(function(){recalc(root)},0)},true);document.readyState==='loading'?document.addEventListener('DOMContentLoaded',place):place();window.addEventListener('load',place);document.addEventListener('shopify:section:load',place);[250,800,1600,3000,5000].forEach(function(t){setTimeout(place,t)});try{new MutationObserver(place).observe(document.documentElement,{childList:true,subtree:true})}catch(e){}})();\u003c\/script\u003e\n","brand":"Vipejar Distribuciones","offers":[{"title":"Default Title","offer_id":54140935110997,"sku":"ESTUCHE-REGALO-PERSONALIZADO-2-BOTELLAS","price":3.5,"currency_code":"EUR","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0509\/4404\/9330\/files\/vipejar-estuche-2-botellas-real.jpg?v=1781540819"}],"url":"https:\/\/vipejar.com\/collections\/estuches-regalo-personalizados.oembed","provider":"Vipejar Distribuciones","version":"1.0","type":"link"}