Author: Jeff Abel

White Heating Green icon

The Importance of Voltage

When purchasing an infrared heater, one of the questions we will inevitably ask you is what voltage is available onsite at your home or commercial

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'); }); }); }); })();