{"id":71,"date":"2026-08-18T14:31:20","date_gmt":"2026-08-18T12:31:20","guid":{"rendered":"https:\/\/wordpress.weblink.it\/demo\/?page_id=71"},"modified":"2026-08-18T14:36:48","modified_gmt":"2026-08-18T12:36:48","slug":"woocommerce-simple-product-finder-demo","status":"publish","type":"page","link":"https:\/\/wordpress.weblink.it\/demo\/woocommerce-simple-product-finder-demo\/","title":{"rendered":"WooCommerce Simple Product Finder (Demo)"},"content":{"rendered":"\n\t<!-- \u2550\u2550 STYLES \u2550\u2550 -->\n\t<style>\n\t.wcspf-wizard { font-family: inherit; max-width: 860px; margin: 0 auto; }\n\n\t\/* Progress *\/\n\t.wcspf-progress { display: flex; align-items: center; margin-bottom: 28px; flex-wrap: wrap; gap: 4px; }\n\t.wcspf-step-indicator { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 80px; }\n\t.wcspf-step-indicator .wcspf-snum {\n\t\tdisplay: inline-flex; align-items: center; justify-content: center;\n\t\twidth: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;\n\t\tfont-size: 12px; font-weight: 700;\n\t\tbackground: #e2e8f0; color: #64748b; transition: background .2s, color .2s; }\n\t.wcspf-step-indicator .wcspf-slabel { font-size: 13px; color: #94a3b8; white-space: nowrap; transition: color .2s; }\n\t.wcspf-step-indicator.active   .wcspf-snum  { background: #1e293b; color: #fff; }\n\t.wcspf-step-indicator.active   .wcspf-slabel{ color: #1e293b; font-weight: 600; }\n\t.wcspf-step-indicator.done     .wcspf-snum  { background: #22c55e; color: #fff; }\n\t.wcspf-step-indicator.done     .wcspf-slabel{ color: #16a34a; }\n\t.wcspf-step-divider { flex: 0 0 20px; height: 2px; background: #e2e8f0; border-radius: 1px; }\n\n\t\/* Breadcrumb *\/\n\t.wcspf-breadcrumb { display: none; align-items: center; gap: 6px; flex-wrap: wrap;\n\t\tbackground: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;\n\t\tpadding: 8px 14px; margin-bottom: 18px; font-size: 13px; }\n\t.wcspf-breadcrumb.wcspf-bc-on { display: flex; }\n\t.wcspf-bc-item { background: #1e293b; color: #fff; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }\n\t.wcspf-bc-sep { color: #94a3b8; }\n\t.wcspf-reset-btn { margin-left: auto; background: none; border: 1px solid #cbd5e1; border-radius: 6px;\n\t\tpadding: 3px 10px; font-size: 12px; color: #64748b; cursor: pointer; }\n\t.wcspf-reset-btn:hover { background: #f1f5f9; color: #1e293b; }\n\n\t\/* Panels *\/\n\t.wcspf-panel { display: none; }\n\t.wcspf-panel.active { display: block; }\n\t.wcspf-panel-title { font-size: 20px; font-weight: 700; margin: 0 0 6px; color: #1e293b; }\n\t.wcspf-step-desc { font-size: 14px; color: #64748b; margin: 0 0 18px; }\n\n\t\/* \u2500\u2500\u2500 Option container base \u2500\u2500\u2500 *\/\n\t.wcspf-options-grid { margin: 16px 0; }\n\n\t\/* \u2500\u2500\u2500 Style: CHIPS (default) \u2500\u2500\u2500 *\/\n\t.wcspf-opts-chips { display: flex; flex-wrap: wrap; gap: 10px; }\n\t.wcspf-opts-chips .wcspf-option-btn {\n\t\tdisplay: inline-flex; align-items: center; gap: 8px;\n\t\tpadding: 9px 18px; border: 2px solid #e2e8f0; border-radius: 8px;\n\t\tbackground: #fff; color: #1e293b; font-size: 14px; font-weight: 600;\n\t\tcursor: pointer; transition: border-color .15s, background .15s; }\n\t.wcspf-opts-chips .wcspf-option-btn:hover    { border-color: #1e293b; background: #f8fafc; }\n\t.wcspf-opts-chips .wcspf-option-btn.selected { border-color: #1e293b; background: #1e293b; color: #fff; }\n\t.wcspf-opts-chips .wcspf-option-btn img.wcspf-term-img { width: 28px; height: 28px; object-fit: contain; border-radius: 3px; }\n\n\t\/* \u2500\u2500\u2500 Style: CARDS \u2500\u2500\u2500 *\/\n\t.wcspf-opts-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }\n\t.wcspf-opts-cards .wcspf-option-btn {\n\t\tdisplay: flex; flex-direction: column; align-items: stretch;\n\t\tpadding: 0; border: 2px solid #e2e8f0; border-radius: 10px;\n\t\tbackground: #fff; color: #1e293b; font-size: 14px; font-weight: 600;\n\t\tcursor: pointer; overflow: hidden; transition: border-color .15s, box-shadow .15s; text-align: center; }\n\t.wcspf-opts-cards .wcspf-option-btn:hover    { border-color: #1e293b; box-shadow: 0 4px 14px rgba(0,0,0,.08); }\n\t.wcspf-opts-cards .wcspf-option-btn.selected { border-color: #1e293b; background: #1e293b; color: #fff; }\n\t.wcspf-opts-cards .wcspf-option-btn img.wcspf-term-img {\n\t\twidth: 100%; height: 100px; object-fit: cover; border-radius: 0; display: block; }\n\t.wcspf-opts-cards .wcspf-option-btn .wcspf-card-noimg {\n\t\twidth: 100%; height: 80px; background: #f1f5f9; display: flex; align-items: center; justify-content: center;\n\t\tfont-size: 28px; color: #cbd5e1; }\n\t.wcspf-opts-cards .wcspf-option-btn span { padding: 10px 8px 12px; display: block; line-height: 1.3; }\n\n\t\/* \u2500\u2500\u2500 Style: LIST \u2500\u2500\u2500 *\/\n\t.wcspf-opts-list { display: flex; flex-direction: column; gap: 6px; }\n\t.wcspf-opts-list .wcspf-option-btn {\n\t\tdisplay: flex; align-items: center; gap: 10px; width: 100%;\n\t\tpadding: 10px 16px; border: 2px solid #e2e8f0; border-radius: 8px;\n\t\tbackground: #fff; color: #1e293b; font-size: 14px; font-weight: 600;\n\t\tcursor: pointer; transition: border-color .15s, background .15s; text-align: left; }\n\t.wcspf-opts-list .wcspf-option-btn:hover    { border-color: #1e293b; background: #f8fafc; }\n\t.wcspf-opts-list .wcspf-option-btn.selected { border-color: #1e293b; background: #1e293b; color: #fff; }\n\t.wcspf-opts-list .wcspf-option-btn img.wcspf-term-img { width: 32px; height: 32px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }\n\n\t\/* Back button *\/\n\t.wcspf-back-btn { background: none; border: 1px solid #cbd5e1; border-radius: 6px;\n\t\tpadding: 6px 14px; font-size: 13px; color: #64748b; cursor: pointer; margin-top: 4px; }\n\t.wcspf-back-btn:hover { background: #f1f5f9; color: #1e293b; }\n\n\t\/* Loader *\/\n\t.wcspf-loader { color: #94a3b8; font-size: 14px; padding: 12px 0; }\n\n\t\/* No results *\/\n\t.wcspf-no-results { color: #94a3b8; font-size: 14px; }\n\n\t\/* Results header *\/\n\t.wcspf-results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }\n\n\t\/* \u2500\u2500\u2500 Results: GRID \u2500\u2500\u2500 *\/\n\t.wcspf-results-grid { display: grid; gap: 16px; margin-top: 8px; }\n\t.wcspf-results-grid[data-cols=\"3\"] { grid-template-columns: repeat(3, 1fr); }\n\t.wcspf-results-grid[data-cols=\"4\"] { grid-template-columns: repeat(4, 1fr); }\n\t.wcspf-results-grid[data-cols=\"5\"] { grid-template-columns: repeat(5, 1fr); }\n\t@media (max-width: 640px) {\n\t\t.wcspf-results-grid[data-cols=\"3\"],\n\t\t.wcspf-results-grid[data-cols=\"4\"],\n\t\t.wcspf-results-grid[data-cols=\"5\"] { grid-template-columns: repeat(2, 1fr); }\n\t}\n\n\t\/* \u2500\u2500\u2500 Results: LIST \u2500\u2500\u2500 *\/\n\t.wcspf-results-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }\n\t.wcspf-results-list .wcspf-product-card { flex-direction: row !important; }\n\t.wcspf-results-list .wcspf-product-card .wcspf-product-img { width: 110px; height: 110px; flex-shrink: 0; object-fit: contain; background: #f8fafc; padding: 8px; box-sizing: border-box; }\n\t.wcspf-results-list .wcspf-product-info { flex: 1; padding: 14px 16px; justify-content: center; }\n\n\t\/* \u2500\u2500\u2500 Product card (shared) \u2500\u2500\u2500 *\/\n\t.wcspf-product-card { display: flex; flex-direction: column; border: 1px solid #e2e8f0; border-radius: 10px;\n\t\toverflow: hidden; text-decoration: none; color: inherit; transition: box-shadow .2s, transform .15s; }\n\t.wcspf-product-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.1); transform: translateY(-2px); }\n\t.wcspf-results-grid .wcspf-product-img { width: 100%; aspect-ratio: 1\/1; object-fit: contain; background: #f8fafc; padding: 8px; box-sizing: border-box; display: block; }\n\t.wcspf-product-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }\n\t.wcspf-product-sku   { font-size: 11px; color: #94a3b8; }\n\t.wcspf-product-title { font-size: 13px; font-weight: 700; color: #1e293b; line-height: 1.3; }\n\t.wcspf-product-price { font-size: 14px; font-weight: 700; color: #16a34a; margin-top: 2px; }\n\t.wcspf-product-link  { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: #2563eb; }\n\t<\/style>\n\n\t<div id=\"ww70i1\" class=\"wcspf-wizard\"\n\t\t data-wizard-id=\"70\"\n\t\t data-total-steps=\"3\">\n\n\t\t<!-- Progress bar -->\n\t\t<div class=\"wcspf-progress\">\n\t\t\t\t\t\t\t\t<div class=\"wcspf-step-indicator active\" data-step=\"0\">\n\t\t\t\t<span class=\"wcspf-snum\">1<\/span>\n\t\t\t\t<span class=\"wcspf-slabel\">Categoria<\/span>\n\t\t\t<\/div>\n\t\t\t\t\t<div class=\"wcspf-step-divider\"><\/div>\t\t\t<div class=\"wcspf-step-indicator \" data-step=\"1\">\n\t\t\t\t<span class=\"wcspf-snum\">2<\/span>\n\t\t\t\t<span class=\"wcspf-slabel\">Colore<\/span>\n\t\t\t<\/div>\n\t\t\t\t\t<div class=\"wcspf-step-divider\"><\/div>\t\t\t<div class=\"wcspf-step-indicator \" data-step=\"2\">\n\t\t\t\t<span class=\"wcspf-snum\">3<\/span>\n\t\t\t\t<span class=\"wcspf-slabel\">Taglia<\/span>\n\t\t\t<\/div>\n\t\t\t\t\t<div class=\"wcspf-step-divider\"><\/div>\n\t\t\t<div class=\"wcspf-step-indicator\" data-step=\"3\">\n\t\t\t\t<span class=\"wcspf-snum\">4<\/span>\n\t\t\t\t<span class=\"wcspf-slabel\">Results<\/span>\n\t\t\t<\/div>\n\t\t<\/div>\n\n\t\t<!-- Breadcrumb -->\n\t\t<div class=\"wcspf-breadcrumb\" id=\"ww70i1-bc\"><\/div>\n\n\t\t<!-- Step panels -->\n\t\t\t\t<div class=\"wcspf-panel active\" id=\"ww70i1-panel-0\">\n\t\t\t<h3 class=\"wcspf-panel-title\">Categoria<\/h3>\n\t\t\t\t\t\t\t<p class=\"wcspf-step-desc\">Che tipo di prodotto stai cercando?<\/p>\n\t\t\t\t\t\t<div class=\"wcspf-loader\" style=\"display:none\">Loading\u2026<\/div>\n\t\t\t<div class=\"wcspf-options-grid wcspf-opts-cards\" id=\"ww70i1-opts-0\">\n\t\t\t\t<button class=\"wcspf-option-btn\" data-value=\"accessories\" data-label=\"Accessories\"><img decoding=\"async\" src=\"https:\/\/wordpress.weblink.it\/demo\/wp-content\/uploads\/2026\/08\/sunglasses-2-100x100.jpg\" alt=\"\" class=\"wcspf-term-img\"><span>Accessories<\/span><\/button><button class=\"wcspf-option-btn\" data-value=\"clothing\" data-label=\"Clothing\"><img decoding=\"async\" src=\"https:\/\/wordpress.weblink.it\/demo\/wp-content\/uploads\/2026\/08\/logo-1-100x100.jpg\" alt=\"\" class=\"wcspf-term-img\"><span>Clothing<\/span><\/button><button class=\"wcspf-option-btn\" data-value=\"decor\" data-label=\"Decor\"><img decoding=\"async\" src=\"https:\/\/wordpress.weblink.it\/demo\/wp-content\/uploads\/2026\/08\/pennant-1-100x100.jpg\" alt=\"\" class=\"wcspf-term-img\"><span>Decor<\/span><\/button><button class=\"wcspf-option-btn\" data-value=\"hoodies\" data-label=\"Hoodies\"><img decoding=\"async\" src=\"https:\/\/wordpress.weblink.it\/demo\/wp-content\/uploads\/2026\/08\/hoodie-with-logo-2-100x100.jpg\" alt=\"\" class=\"wcspf-term-img\"><span>Hoodies<\/span><\/button><button class=\"wcspf-option-btn\" data-value=\"music\" data-label=\"Music\"><img decoding=\"async\" src=\"https:\/\/wordpress.weblink.it\/demo\/wp-content\/uploads\/2026\/08\/cap-2-100x100.jpg\" alt=\"\" class=\"wcspf-term-img\"><span>Music<\/span><\/button><button class=\"wcspf-option-btn\" data-value=\"tshirts\" data-label=\"Tshirts\"><img decoding=\"async\" src=\"https:\/\/wordpress.weblink.it\/demo\/wp-content\/uploads\/2026\/08\/vnech-tee-blue-1-100x100.jpg\" alt=\"\" class=\"wcspf-term-img\"><span>Tshirts<\/span><\/button>\t\t\t<\/div>\n\t\t\t<p class=\"wcspf-no-results\" style=\"display:none\">No options available for this selection.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"wcspf-panel \" id=\"ww70i1-panel-1\">\n\t\t\t<h3 class=\"wcspf-panel-title\">Colore<\/h3>\n\t\t\t\t\t\t\t<p class=\"wcspf-step-desc\">Scegli il colore<\/p>\n\t\t\t\t\t\t<div class=\"wcspf-loader\" style=\"display:none\">Loading\u2026<\/div>\n\t\t\t<div class=\"wcspf-options-grid wcspf-opts-cards\" id=\"ww70i1-opts-1\">\n\t\t\t\t\t\t\t<\/div>\n\t\t\t<p class=\"wcspf-no-results\" style=\"display:none\">No options available for this selection.<\/p>\n\t\t\t\t\t\t\t<button class=\"wcspf-back-btn\" data-goto=\"0\">\u2190 Back<\/button>\n\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"wcspf-panel \" id=\"ww70i1-panel-2\">\n\t\t\t<h3 class=\"wcspf-panel-title\">Taglia<\/h3>\n\t\t\t\t\t\t\t<p class=\"wcspf-step-desc\">Infine, scegli la taglia<\/p>\n\t\t\t\t\t\t<div class=\"wcspf-loader\" style=\"display:none\">Loading\u2026<\/div>\n\t\t\t<div class=\"wcspf-options-grid wcspf-opts-cards\" id=\"ww70i1-opts-2\">\n\t\t\t\t\t\t\t<\/div>\n\t\t\t<p class=\"wcspf-no-results\" style=\"display:none\">No options available for this selection.<\/p>\n\t\t\t\t\t\t\t<button class=\"wcspf-back-btn\" data-goto=\"1\">\u2190 Back<\/button>\n\t\t\t\t\t<\/div>\n\t\t\n\t\t<!-- Results panel -->\n\t\t<div class=\"wcspf-panel\" id=\"ww70i1-panel-3\">\n\t\t\t<div class=\"wcspf-results-header\">\n\t\t\t\t<h3 class=\"wcspf-panel-title\" id=\"ww70i1-results-title\">Products found<\/h3>\n\t\t\t\t<button class=\"wcspf-back-btn\" data-goto=\"2\">\u2190 Back<\/button>\n\t\t\t<\/div>\n\t\t\t<div class=\"wcspf-loader\" style=\"display:none\">Loading products\u2026<\/div>\n\t\t\t<div class=\"wcspf-results-grid\"\n\t\t\t\t data-cols=\"3\"\n\t\t\t\t id=\"ww70i1-products\"><\/div>\n\t\t\t<p class=\"wcspf-no-results\" style=\"display:none\">No products found for this combination.<\/p>\n\t\t<\/div>\n\n\t<\/div><!-- \/.wcspf-wizard -->\n\n\t<script>\n\t(function() {\n\t\tvar wizardEl   = document.getElementById('ww70i1');\n\t\tvar wizardId   = 70;\n\t\tvar uid        = 'ww70i1';\n\t\tvar totalSteps = 3;\n\t\tvar ajaxUrl    = 'https:\/\/wordpress.weblink.it\/demo\/wp-admin\/admin-ajax.php';\n\t\tvar nonce      = '4538fbfd2a';\n\n\t\tvar stepTaxonomies = [\"product_cat\",\"pa_color\",\"pa_size\"];\n\t\tvar optStyle       = 'cards';   \/\/ chips | cards | list\n\t\tvar resLayout      = 'grid';  \/\/ grid | list\n\t\tvar resFields      = [\"image\",\"title\",\"price\",\"link\"]; \/\/ ['image','sku','title','price','link']\n\n\t\tvar selections = [];\n\n\t\t\/* \u2500\u2500 helpers \u2500\u2500 *\/\n\n\t\tfunction showPanel(n) {\n\t\t\twizardEl.querySelectorAll('.wcspf-panel').forEach(function(p) { p.classList.remove('active'); });\n\t\t\tdocument.getElementById(uid + '-panel-' + n).classList.add('active');\n\t\t\twizardEl.querySelectorAll('.wcspf-step-indicator').forEach(function(s) {\n\t\t\t\tvar sn = parseInt(s.dataset.step);\n\t\t\t\ts.classList.remove('active', 'done');\n\t\t\t\tif (sn === n) s.classList.add('active');\n\t\t\t\tif (sn < n)  s.classList.add('done');\n\t\t\t});\n\t\t\tupdateBreadcrumb();\n\t\t}\n\n\t\tfunction updateBreadcrumb() {\n\t\t\tvar bc = document.getElementById(uid + '-bc');\n\t\t\tif (!selections.length) { bc.classList.remove('wcspf-bc-on'); return; }\n\t\t\tbc.classList.add('wcspf-bc-on');\n\t\t\tvar html = selections.map(function(s) {\n\t\t\t\treturn '<span class=\"wcspf-bc-item\">' + escHtml(s.term_label) + '<\/span>';\n\t\t\t}).join('<span class=\"wcspf-bc-sep\"> \u203a <\/span>');\n\t\t\thtml += '<button class=\"wcspf-reset-btn\" onclick=\"wcspfReset_' + wizardId + '_' + uid + '()\">\u2715 Start over<\/button>';\n\t\t\tbc.innerHTML = html;\n\t\t}\n\n\t\twindow['wcspfReset_' + wizardId + '_' + uid] = function() {\n\t\t\tselections = [];\n\t\t\tshowPanel(0);\n\t\t};\n\n\t\tfunction escHtml(str) {\n\t\t\treturn String(str).replace(\/&\/g,'&amp;').replace(\/<\/g,'&lt;').replace(\/>\/g,'&gt;').replace(\/\"\/g,'&quot;');\n\t\t}\n\n\t\tfunction post(action, data, cb) {\n\t\t\tvar body = new FormData();\n\t\t\tbody.append('action', action);\n\t\t\tbody.append('nonce', nonce);\n\t\t\tfor (var k in data) body.append(k, typeof data[k] === 'object' ? JSON.stringify(data[k]) : data[k]);\n\t\t\tfetch(ajaxUrl, { method: 'POST', body: body })\n\t\t\t\t.then(function(r){ return r.json(); })\n\t\t\t\t.then(cb)\n\t\t\t\t.catch(function(){ console.error('WCSPF AJAX error'); });\n\t\t}\n\n\t\t\/* Build button inner HTML based on option style *\/\n\t\tfunction optionInner(item) {\n\t\t\tvar imgTag = item.image_url\n\t\t\t\t? '<img decoding=\"async\" src=\"' + escHtml(item.image_url) + '\" alt=\"\" class=\"wcspf-term-img\">'\n\t\t\t\t: '';\n\t\t\tif (optStyle === 'cards') {\n\t\t\t\treturn (imgTag || '<div class=\"wcspf-card-noimg\">\u2606<\/div>') + '<span>' + escHtml(item.name) + '<\/span>';\n\t\t\t}\n\t\t\treturn imgTag + '<span>' + escHtml(item.name) + '<\/span>';\n\t\t}\n\n\t\tfunction renderOptions(containerId, items, onClickFn) {\n\t\t\tvar grid = document.getElementById(containerId);\n\t\t\tgrid.innerHTML = '';\n\t\t\titems.forEach(function(item) {\n\t\t\t\tvar btn = document.createElement('button');\n\t\t\t\tbtn.className    = 'wcspf-option-btn';\n\t\t\t\tbtn.dataset.value = item.slug;\n\t\t\t\tbtn.innerHTML    = optionInner(item);\n\t\t\t\tbtn.addEventListener('click', function() { onClickFn(item); });\n\t\t\t\tgrid.appendChild(btn);\n\t\t\t});\n\t\t}\n\n\t\t\/* Step 1: server-side rendered \u2014 just wire up click handlers *\/\n\t\tvar opts0 = document.getElementById(uid + '-opts-0');\n\t\tif (opts0) {\n\t\t\topts0.querySelectorAll('.wcspf-option-btn').forEach(function(btn) {\n\t\t\t\tbtn.addEventListener('click', function() {\n\t\t\t\t\tselections = [{\n\t\t\t\t\t\ttaxonomy:   stepTaxonomies[0],\n\t\t\t\t\t\tterm_slug:  btn.dataset.value,\n\t\t\t\t\t\tterm_label: btn.querySelector('span') ? btn.querySelector('span').textContent : btn.dataset.value\n\t\t\t\t\t}];\n\t\t\t\t\tloadStep(1);\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tfunction loadStep(stepIndex) {\n\t\t\tif (stepIndex >= totalSteps) { loadProducts(); return; }\n\n\t\t\tvar panel  = document.getElementById(uid + '-panel-' + stepIndex);\n\t\t\tvar loader = panel.querySelector('.wcspf-loader');\n\t\t\tvar noRes  = panel.querySelector('.wcspf-no-results');\n\t\t\tvar grid   = document.getElementById(uid + '-opts-' + stepIndex);\n\n\t\t\tshowPanel(stepIndex);\n\t\t\tloader.style.display = '';\n\t\t\tgrid.innerHTML = '';\n\t\t\tnoRes.style.display = 'none';\n\n\t\t\tvar prevSels = selections.map(function(s){ return { taxonomy: s.taxonomy, term_slug: s.term_slug }; });\n\n\t\t\tpost('wcspf_get_options', {\n\t\t\t\twizard_id:       wizardId,\n\t\t\t\tstep_index:      stepIndex,\n\t\t\t\tselections_json: prevSels\n\t\t\t}, function(res) {\n\t\t\t\tloader.style.display = 'none';\n\t\t\t\tif (!res.success || !res.data.length) { noRes.style.display = ''; return; }\n\t\t\t\trenderOptions(uid + '-opts-' + stepIndex, res.data, function(item) {\n\t\t\t\t\tselections = selections.slice(0, stepIndex);\n\t\t\t\t\tselections.push({ taxonomy: stepTaxonomies[stepIndex], term_slug: item.slug, term_label: item.name });\n\t\t\t\t\tloadStep(stepIndex + 1);\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t\/* Build product card HTML from field settings *\/\n\t\tfunction productCardHtml(p) {\n\t\t\tvar imgHtml  = resFields.indexOf('image') >= 0\n\t\t\t\t? '<img decoding=\"async\" src=\"' + escHtml(p.img) + '\" alt=\"' + escHtml(p.title) + '\" loading=\"lazy\" class=\"wcspf-product-img\">'\n\t\t\t\t: '';\n\t\t\tvar info = '';\n\t\t\tif (resFields.indexOf('sku')   >= 0) info += '<div class=\"wcspf-product-sku\">SKU: '  + escHtml(p.sku || '\u2014') + '<\/div>';\n\t\t\tif (resFields.indexOf('title') >= 0) info += '<div class=\"wcspf-product-title\">'      + escHtml(p.title)       + '<\/div>';\n\t\t\tif (resFields.indexOf('price') >= 0) info += '<div class=\"wcspf-product-price\">'      + p.price               + '<\/div>';\n\t\t\tif (resFields.indexOf('link')  >= 0) info += '<span class=\"wcspf-product-link\">View product \u2192<\/span>';\n\t\t\treturn '<a href=\"' + escHtml(p.url) + '\" class=\"wcspf-product-card\">'\n\t\t\t\t+ imgHtml\n\t\t\t\t+ '<div class=\"wcspf-product-info\">' + info + '<\/div>'\n\t\t\t\t+ '<\/a>';\n\t\t}\n\n\t\tfunction loadProducts() {\n\t\t\tvar panel  = document.getElementById(uid + '-panel-' + totalSteps);\n\t\t\tvar loader = panel.querySelector('.wcspf-loader');\n\t\t\tvar noRes  = panel.querySelector('.wcspf-no-results');\n\t\t\tvar grid   = document.getElementById(uid + '-products');\n\n\t\t\tshowPanel(totalSteps);\n\t\t\tloader.style.display = '';\n\t\t\tgrid.innerHTML = '';\n\t\t\tnoRes.style.display = 'none';\n\n\t\t\tvar sels = selections.map(function(s){ return { taxonomy: s.taxonomy, term_slug: s.term_slug }; });\n\n\t\t\tpost('wcspf_get_products', { selections_json: sels }, function(res) {\n\t\t\t\tloader.style.display = 'none';\n\t\t\t\tif (!res.success || !res.data.products.length) { noRes.style.display = ''; return; }\n\t\t\t\tvar c = res.data.count;\n\t\t\t\tdocument.getElementById(uid + '-results-title').textContent =\n\t\t\t\t\tc + ' product' + (c === 1 ? ' found' : 's found');\n\t\t\t\tres.data.products.forEach(function(p) {\n\t\t\t\t\tgrid.insertAdjacentHTML('beforeend', productCardHtml(p));\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\twizardEl.querySelectorAll('.wcspf-back-btn').forEach(function(btn) {\n\t\t\tbtn.addEventListener('click', function() {\n\t\t\t\tvar goto = parseInt(btn.dataset.goto);\n\t\t\t\tselections = selections.slice(0, goto);\n\t\t\t\tshowPanel(goto);\n\t\t\t});\n\t\t});\n\n\t})();\n\t<\/script>\n\t\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-3e41869c wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-75\"><a class=\"wp-block-button__link has-white-color has-vivid-cyan-blue-background-color has-text-color has-background has-link-color has-large-font-size has-custom-font-size wp-element-button\" href=\"https:\/\/wordpress.weblink.it\/prodotto\/woocommerce-simple-product-finder\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Acquista plugin<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-71","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/wordpress.weblink.it\/demo\/wp-json\/wp\/v2\/pages\/71","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.weblink.it\/demo\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/wordpress.weblink.it\/demo\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.weblink.it\/demo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.weblink.it\/demo\/wp-json\/wp\/v2\/comments?post=71"}],"version-history":[{"count":3,"href":"https:\/\/wordpress.weblink.it\/demo\/wp-json\/wp\/v2\/pages\/71\/revisions"}],"predecessor-version":[{"id":74,"href":"https:\/\/wordpress.weblink.it\/demo\/wp-json\/wp\/v2\/pages\/71\/revisions\/74"}],"wp:attachment":[{"href":"https:\/\/wordpress.weblink.it\/demo\/wp-json\/wp\/v2\/media?parent=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}