{"product_id":"sandalias-casualaes","title":"Sandalías Casualaes","description":"\u003cdiv class=\"c-sw\"\u003e\n  \u003cspan class=\"sw-lbl\"\u003eColor - \u003cspan id=\"selected-color-name\"\u003eNegro\u003c\/span\u003e\u003c\/span\u003e\n  \u003cdiv class=\"sg-sw\"\u003e\n    \u003cbutton type=\"button\" class=\"sw-btn active\" data-color=\"Negro\" data-slide-index=\"1\" style=\"--swatch-bg:#1a1a1a\" title=\"Negro\"\u003e\u003c\/button\u003e\n    \n    \u003cbutton type=\"button\" class=\"sw-btn\" data-color=\"Blanco\" data-slide-index=\"2\" style=\"--swatch-bg:#ffffff; border: 1px solid #e1e1e1;\" title=\"Blanco\"\u003e\u003c\/button\u003e\n  \u003c\/div\u003e\n\u003c\/div\u003e\n\n\u003cstyle\u003e\n  .c-sw {\n    margin: 20px 0;\n  }\n  .sw-lbl {\n    display: block;\n    font-size: 14px; \n    color: #2b2b2b;\n    margin-bottom: 12px;\n    font-family: \"New York\", -apple-system-serif, \"Playfair Display\", \"Georgia\", \"Times New Roman\", serif;\n    font-weight: 400;\n    letter-spacing: 0.1px;\n    -webkit-font-smoothing: antialiased;\n  }\n  #selected-color-name {\n    font-weight: 400;\n  }\n  .sg-sw {\n    display: flex;\n    gap: 12px;\n  }\n  .sw-btn {\n    width: 44px; \n    height: 44px;\n    border-radius: 9px;\n    border: 1px solid transparent;\n    background: var(--swatch-bg);\n    cursor: pointer;\n    position: relative;\n    box-sizing: border-box;\n    padding: 0;\n  }\n  .sw-btn.active {\n    border: 1.5px solid #8c867a !important; \n    box-shadow: inset 0 0 0 3px #ffffff;\n  }\n  .sw-btn:focus {\n    outline: none;\n  }\n\u003c\/style\u003e\n\n\u003cscript\u003e\n  (function() {\n    \/\/ Función que busca las miniaturas reales de la plantilla y pulsa la que corresponda\n    function moverCarruselPorPosicion(numeroFoto) {\n      \/\/ Intentamos localizar los botones o elementos de las miniaturas del producto\n      const miniaturas = document.querySelectorAll('.product__thumbnail-item button, .thumbnail-list__item button, .product__thumb, .thumbnail-item');\n      \n      if (miniaturas \u0026\u0026 miniaturas.length \u003e= numeroFoto) {\n        \/\/ Hacemos clic en la miniatura exacta (el índice en programación empieza en 0, así que restamos 1)\n        miniaturas[numeroFoto - 1].click();\n      } else {\n        \/\/ Alternativa si el tema usa un slider continuo sin botones de miniaturas\n        const diapositivas = document.querySelectorAll('.product__media-item, .swiper-slide, .slick-slide');\n        if (diapositivas \u0026\u0026 diapositivas.length \u003e= numeroFoto) {\n          diapositivas[numeroFoto - 1].scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });\n        }\n      }\n    }\n\n    \/\/ Oculta el selector nativo duplicado de la plantilla\n    function ocultarSelectorNativoColor() {\n      const etiquetas = document.querySelectorAll('label, span, legend, h4, .form__label');\n      etiquetas.forEach(el =\u003e {\n        const texto = (el.innerText || \"\").toLowerCase().trim();\n        if (texto === 'color' || texto.includes('color -')) {\n          const contenedor = el.closest('.product-form__input, .variant-wrapper, fieldset, div[class*=\"variant\"]');\n          if (contenedor \u0026\u0026 !contenedor.classList.contains('c-sw')) {\n            contenedor.style.setProperty('display', 'none', 'important');\n          }\n        }\n      });\n    }\n\n    setInterval(ocultarSelectorNativoColor, 100);\n\n    \/\/ Al hacer clic en tus botones personalizados\n    document.addEventListener('click', function(e) {\n      const boton = e.target.closest('.sw-btn');\n      if (!boton) return;\n      \n      e.preventDefault();\n      \n      document.querySelectorAll('.sw-btn').forEach(x =\u003e x.classList.remove('active'));\n      boton.classList.add('active');\n      document.getElementById('selected-color-name').textContent = boton.dataset.color;\n      \n      \/\/ Llamamos a la función pasándole el número de foto (1 o 2)\n      moverCarruselPorPosicion(parseInt(boton.getAttribute('data-slide-index')));\n\n      \/\/ Sincroniza la variante con Shopify de forma nativa\n      const colorOriginal = boton.dataset.color.toLowerCase();\n      const opcionesNativas = document.querySelectorAll('.product-form__input input, .product-form__input label, .swatch-element, [class*=\"variant\"] option, [class*=\"swatch\"], [class*=\"color-swatch\"]');\n      \n      opcionesNativas.forEach(el =\u003e {\n        const textoEl = (el.innerText || el.value || el.getAttribute('aria-label') || \"\").toLowerCase().trim();\n        if (\/\\d\/.test(textoEl)) return; \/\/ Ignora tallas\n\n        if (textoEl.includes(colorOriginal)) {\n          if (el.tagName === 'INPUT') {\n            el.checked = true;\n            el.dispatchEvent(new Event('change', { bubbles: true }));\n          } else if (el.tagName === 'OPTION') {\n            let select = el.closest('select');\n            if(select) {\n              select.value = el.value;\n              select.dispatchEvent(new Event('change', { bubbles: true }));\n            }\n          } else {\n            el.click();\n          }\n        }\n      });\n    });\n  })();\n\u003c\/script\u003e","brand":"Mi tienda","offers":[{"title":"36 \/ Negro","offer_id":57667341681022,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"36 \/ Blanco","offer_id":57667341713790,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"37 \/ Negro","offer_id":57667341746558,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"37 \/ Blanco","offer_id":57667341779326,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"38 \/ Negro","offer_id":57667341812094,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"38 \/ Blanco","offer_id":57667341844862,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"39 \/ Negro","offer_id":57667341877630,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":false},{"title":"39 \/ Blanco","offer_id":57667341910398,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"40 \/ Negro","offer_id":57667341943166,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"40 \/ Blanco","offer_id":57667341975934,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"41 \/ Negro","offer_id":57667342008702,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"41 \/ Blanco","offer_id":57667342041470,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"42 \/ Negro","offer_id":57667342074238,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"42 \/ Blanco","offer_id":57667342107006,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"43 \/ Negro","offer_id":57667342139774,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":true},{"title":"43 \/ Blanco","offer_id":57667342172542,"sku":null,"price":16.99,"currency_code":"EUR","in_stock":false}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/1008\/4804\/2366\/files\/1.avif?v=1783609696","url":"https:\/\/luzdemoda.com\/products\/sandalias-casualaes","provider":"LuzDeModa","version":"1.0","type":"link"}