// =========================================================================
// 5. CART DESKTOP — SPLIT TITLE ROW ABOVE SKU/QTY/PRICE
// JS restructures each cart row so product name spans full width on
// its own row, with SKU/qty/price on a second row below it.
// Only runs on cart.php at >800px. Added: March 23 2026
// =========================================================================
(function fixCartDesktop() {
if (!window.location.pathname.includes('cart.php')) return;
if (!window.matchMedia('(min-width: 801px)').matches) return;
function doFix() {
document.querySelectorAll('.cart-item').forEach(function(row) {
if (row.querySelector('.jrc-cart-row-top')) return; // already done
var figure = row.querySelector('.cart-item-figure');
var title = row.querySelector('.cart-item-title');
var price = row.querySelector('.cart-item-price');
var qty = row.querySelector('.cart-item-quantity');
var total = row.querySelector('.cart-item-total');
var edit = row.querySelector('.cart-item-edit');
if (!figure || !title || !price || !qty || !edit) return;
// Extract just the product name element from title
var nameEl = title.querySelector('.cart-item-name, h2.cart-item-name, .cart-item-name a');
if (!nameEl) nameEl = title.querySelector('h2, h3');
// Pull SKU/options/change out of title into a new cell
var skuCell = document.createElement('td');
skuCell.className = 'cart-item-block jrc-cart-sku-cell';
// Move everything from title except the name into skuCell
Array.from(title.childNodes).forEach(function(node) {
if (!nameEl || !nameEl.contains(node) && node !== nameEl) {
skuCell.appendChild(node.cloneNode(true));
}
});
// Leave only the name in title
Array.from(title.childNodes).forEach(function(node) {
if (node !== nameEl && !(nameEl && nameEl.parentNode === title && node === nameEl.parentNode)) {
// keep only nameEl
}
});
// Clear title and re-append just the name
title.innerHTML = '';
if (nameEl) title.appendChild(nameEl.cloneNode(true));
// Set colspan/rowspan
figure.setAttribute('rowspan', '2');
title.setAttribute('colspan', '5');
title.style.cssText = 'padding-bottom: 4px !important;';
// Build top row from existing row
row.classList.add('jrc-cart-row-top');
// Remove price/qty/total/edit from top row
[price, qty, total, edit].forEach(function(el) {
if (el) el.parentNode && el.parentNode.removeChild(el);
});
// Build bottom row
var bottomRow = document.createElement('tr');
bottomRow.className = 'cart-item jrc-cart-row-bottom';
bottomRow.appendChild(skuCell);
if (price) bottomRow.appendChild(price);
if (qty) bottomRow.appendChild(qty);
if (total) bottomRow.appendChild(total);
if (edit) bottomRow.appendChild(edit);
row.parentNode.insertBefore(bottomRow, row.nextSibling);
});
}
doFix();
var attempts = 0;
var interval = setInterval(function() {
if (window.matchMedia('(min-width: 801px)').matches) doFix();
attempts++;
if (attempts >= 10) clearInterval(interval);
}, 300);
var observer = new MutationObserver(function() {
if (window.matchMedia('(min-width: 801px)').matches) doFix();
});
observer.observe(document.body, { childList: true, subtree: true });
})();
SwivelMaster T-Bar by Moerman
Introducing the SwivelMaster T-bar, a groundbreaking innovation in the realm of window cleaning. Far more than just a tool, it represents a revolution born from...
Moerman Fixed T-Bar
The superior plastic T-Bar from Moerman is a clever option for any application.
The Bi-Component handle feels natural and comfortable to hold with its ergonomic shaped...
The super smooth swivel movement can be used at 0, 25 and 40 degrees by pushing the button.
FEATURES
Adaptable angle 10° - 25° - 40°
Super smooth swivel...
Window Cleaners love Pulex Squeegees for cleaning glass and mirrors the Pulex Squeegee is the professionals choice for window cleaning.
Pulex T-Bar Swivel
The Pulex T-Bar Swivel is a...
Sorbo Swivel T-Bar – Durable, Easy-to-Use Tool for Effortless Window Cleaning
The Sorbo Swivel T-Bar is designed for professionals who demand durability and ease of use. Made from .050...