(function(){ const logPrefix = '[hide-products-if-subcats]'; const subSelectors = [ '.sub-cat-container', '.woocommerce-loop-category', 'li.product-category', '.product-category', '.wc-block-grid__product-category', '.woocommerce-category', '.woocommerce-ProductCategories', '.product-cats', '.term-list' ]; const prodSelectors = [ '.products', 'ul.products', '.wc-block-grid__products', '.woocommerce ul.products', '.elementor-widget-woocommerce-products', '.products-container', '.woocommerce-LoopProduct', '.products-grid' ]; function checkSubNode(node) { if(!node) return false; return node.querySelectorAll( 'li.product-category, .woocommerce-loop-category, .product-category, .wc-block-grid__product-category, a[href*="/product-category/"], a[href*="?product_cat="]' ).length > 0; } function findSub() { for (let sel of subSelectors) { try { const nodes = document.querySelectorAll(sel); if (nodes && nodes.length) { for (let n of nodes) if (checkSubNode(n)) return n; } } catch(e){} } // fallback: any link that looks like a category link const catLink = document.querySelector('a[href*="/product-category/"], a[href*="?product_cat="]'); return catLink ? (catLink.closest('ul,div,section') || catLink.parentElement) : null; } function findProductsContainer() { for (let sel of prodSelectors) { try { const el = document.querySelector(sel); if (el) return el; } catch(e){} } // fallback: locate an ancestor that holds many .product items const sample = document.querySelector('li.product, .product, .woocommerce-loop-product__title'); if (sample) { let anc = sample.parentElement; while (anc && anc !== document.body) { if (anc.querySelectorAll('li.product, .product').length > 0 && anc !== sample) return anc; anc = anc.parentElement; } } return null; } // add strong CSS rule const style = document.createElement('style'); style.textContent = '.hidden-by-subcats{display:none !important; visibility:hidden !important; height:0 !important; margin:0 !important; padding:0 !important;}'; document.head && document.head.appendChild(style); let done = false; const start = Date.now(); const interval = 500; const timeout = 60000; // 60s const timer = setInterval(()=>{ if (done) { clearInterval(timer); return; } try { const sub = findSub(); if (sub) { const prod = document.querySelector('.products-container') || findProductsContainer() || sub.nextElementSibling; if (prod) { prod.classList.add('hidden-by-subcats'); console.log(logPrefix, 'Hidden products container:', prod); done = true; clearInterval(timer); return; } else { console.log(logPrefix, 'Subcategories found but products container not detected yet.'); } } else { console.log(logPrefix, 'No subcategories detected yet.'); } } catch (err) { console.error(logPrefix, 'Error:', err); } if (Date.now() - start > timeout) { clearInterval(timer); console.log(logPrefix, 'Timeout reached; stopped checking.'); } }, interval); })();
Roll Back Straps
Blog Posts

Auto Transport Straps for Sale

When it comes to transporting vehicles, safety is paramount. One of the most important components in ensuring that your vehicle arrives at its destination in perfect condition is using the right auto transport straps. If you are looking for auto transport straps for sale, you are in the right place. This article will guide you through everything you need to know about auto transport straps, including their types, where to buy them, and how to choose the best ones for your needs.

Shopping Cart
Scroll to Top
Call Now Button