// =========================================================================
// 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 });
})();
Street Elbow Brass 1/2inProTool Street Elbow Brass 1/2in 90 Degree is engineered for optimal performance in plumbing and piping systems. Crafted with high-quality brass, this fitting promises...
Elbow 90deg Street 1/2in Robust Construction: Made with a polypropylene frame reinforced with glass, offering increased chemical resistance, strength, and pressure resistance.Versatile...
1/4" Elbow that changes fitting type. You will now be connecting to a male connector.Achieve seamless connections and durability with the ProTool Street Elbow Brass 1/4in. This high-quality brass...
1/8" Elbow that changes fitting type. You will now be connecting to a male connector.Transform your plumbing projects with the ProTool Street Elbow Brass 1/8in, expertly designed to facilitate...
Elbow 3/8 StemThe ProTool Elbow 3/8 Stem is an essential plumbing fitting designed for seamless connections in various applications. Engineered with precision, this elbow fitting provides a reliable...