{"product_id":"bolso-mimbre-hombro","title":"Bolso Mimbre Hombro","description":"\u003cscript\u003e\n  (function() {\n    \/\/ Función para activar el cambio de foto en la galería\n    function cambiarFotoGaleria(numeroFoto) {\n      const idx = numeroFoto - 1;\n      \n      \/\/ 1. Intentar hacer clic en las miniaturas\n      const miniaturas = document.querySelectorAll(\n        '.product__thumbnail-item button, .thumbnail-list__item button, .product__thumb, .thumbnail-item, .product-single__thumbnail, slider-component .thumbnail'\n      );\n      if (miniaturas \u0026\u0026 miniaturas[idx]) {\n        try { miniaturas[idx].click(); return; } catch(e) {}\n      }\n\n      \/\/ 2. Si no hay miniaturas, hacer scroll elástico a la imagen grande\n      const diapositivas = document.querySelectorAll(\n        '.product__media-item, .product__media-list .product__media-item, .slider__slide, .swiper-slide, .slick-slide, .product-main-slide, [id^=\"Slide-\"]'\n      );\n      if (diapositivas \u0026\u0026 diapositivas[idx]) {\n        const slide = diapositivas[idx];\n        const wrapper = slide.closest('.grid, .slider, .product__media-list, .media-gallery__carousel') || slide.parentElement;\n        if (wrapper) {\n          wrapper.scrollTo({ left: slide.offsetLeft, behavior: 'smooth' });\n          wrapper.dispatchEvent(new Event('scroll', { bubbles: true }));\n        } else {\n          slide.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });\n        }\n      }\n    }\n\n    \/\/ Escucha global en el documento (inmune a que su contenedor propio esté oculto)\n    document.addEventListener('change', function(evento) {\n      const el = evento.target;\n      \n      \/\/ Detectar si el cambio viene de un selector de variantes nativo de Shopify\n      if (el.matches('.product-form__input input, .product-form__input select, [class*=\"variant\"] select, [class*=\"variant\"] input')) {\n        let valor = (el.tagName === 'INPUT' \u0026\u0026 el.checked) ? el.value : (el.tagName === 'SELECT' ? el.value : \"\");\n        if (!valor) return;\n        \n        valor = valor.toLowerCase().trim();\n\n        \/\/ Mapeo de tus variantes a las posiciones de foto\n        if (valor === 'beige khaki' || valor.includes('beige')) {\n          cambiarFotoGaleria(1); \/\/ Va a la 1ª foto\n        } else if (valor === 'blanco roto' || valor.includes('blanco')) {\n          cambiarFotoGaleria(4); \/\/ Va a la 4ª foto\n        }\n      }\n    }, true); \/\/ Captura global activada para asegurar la ejecución inmediata\n  })();\n\u003c\/script\u003e","brand":"Mi tienda","offers":[{"title":"Beige Khaki","offer_id":57696924696958,"sku":null,"price":14.99,"currency_code":"EUR","in_stock":true},{"title":"Blanco roto","offer_id":57696924729726,"sku":null,"price":14.99,"currency_code":"EUR","in_stock":false}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/1008\/4804\/2366\/files\/ChatGPTImage12jul2026_18_20_00.png?v=1783874024","url":"https:\/\/luzdemoda.com\/products\/bolso-mimbre-hombro","provider":"LuzDeModa","version":"1.0","type":"link"}