January 20, 2023

Burning Questions About Infrared Heating

Infrared heating is an efficient, versatile, and increasingly popular solution for addressing many common heating challenges. It can be installed almost anywhere—from homes to yoga studios—offering a unique alternative to conventional heating systems. However, many people have questions about how infrared heating works, the best ways to use it, and what factors to consider before […]

Burning Questions About Infrared Heating Read More »

Shopping Cart
(function () { // Early exit if the page doesn't have our UI document.addEventListener('DOMContentLoaded', function () { console.log('[HG] JS loaded'); // Sanity checks if (!window.hg_ajax_obj || !window.hg_ajax_obj.ajaxurl) { console.error('[HG] ajaxurl missing. Is the PHP snippet active?'); return; } var grid = document.getElementById('product-grid'); if (!grid) { console.error('[HG] #product-grid not found. Set the CSS ID on the section containing the Woo Products widget.'); return; } // Use event delegation so columns/buttons/inner elements all work document.addEventListener('click', function (e) { var btn = e.target.closest('.ajax-filter-btn'); if (!btn) return; e.preventDefault(); // Read tag from data attribute var tag = btn.getAttribute('data-tag'); if (!tag) { console.warn('[HG] Clicked filter has no data-tag'); return; } // Active state document.querySelectorAll('.ajax-filter-btn.active').forEach(function (el) { el.classList.remove('active'); }); btn.classList.add('active'); // Loading state grid.classList.add('loading'); console.log('[HG] Sending AJAX for tag:', tag, '→', window.hg_ajax_obj.ajaxurl); // AJAX (fetch) var form = new FormData(); form.append('action', 'heatinggreen_filter_products'); form.append('tag', tag); fetch(window.hg_ajax_obj.ajaxurl, { method: 'POST', credentials: 'same-origin', body: form }) .then(function (r) { return r.json(); }) .then(function (json) { if (!json) { console.error('[HG] Empty JSON response'); return; } if (json.success) { grid.innerHTML = json.data.html; console.log('[HG] Updated grid for tag:', tag); } else { console.error('[HG] Server error:', json.data && json.data.message ? json.data.message : json); } }) .catch(function (err) { console.error('[HG] AJAX error:', err); }) .finally(function () { grid.classList.remove('loading'); }); }); }); })();