{"id":1166,"date":"2021-09-04T12:56:42","date_gmt":"2021-09-04T12:56:42","guid":{"rendered":"http:\/\/fastwpdemo.com\/newwp\/speedia\/cart\/"},"modified":"2026-02-12T15:54:53","modified_gmt":"2026-02-12T15:54:53","slug":"cart-2","status":"publish","type":"page","link":"https:\/\/hgxautoparts.com\/?page_id=1166","title":{"rendered":"Cart"},"content":{"rendered":"<div class=\"woocommerce\"><div class=\"woocommerce-notices-wrapper\"><\/div><div class=\"wc-empty-cart-message\">\n\t<div class=\"cart-empty woocommerce-info\" role=\"status\">\n\t\tYour cart is currently empty.\t<\/div>\n<\/div>\t<p class=\"return-to-shop\">\n\t\t<a class=\"button wc-backward\" href=\"https:\/\/hgxautoparts.com\/?page_id=10\">\n\t\t\tReturn to shop\t\t<\/a>\n\t<\/p>\n<\/div>\n\n\n\n<script>\ndocument.addEventListener('DOMContentLoaded', function () {\n\n    const interval = setInterval(() => {\n\n        \/\/ Find the \"Estimated total\" row\n        let estimatedRow = null;\n\n        document.querySelectorAll('.wc-block-components-totals-item').forEach(row => {\n            let label = row.querySelector('.wc-block-components-totals-item__label');\n            if (label && label.innerText.toLowerCase().includes('estimated')) {\n                estimatedRow = row;\n            }\n        });\n\n        \/\/ If found and button not already added\n        if (estimatedRow && !document.querySelector('.wa-order-button')) {\n\n            const button = document.createElement('button');\n            button.type = 'button';\n            button.className = 'wa-order-button button alt';\n            button.innerText = 'Order On WhatsApp';\n\n            \/\/ Insert button just after estimated total\n            estimatedRow.after(button);\n\n            \/\/ Button click action\n            button.addEventListener('click', function () {\n\n                let message = \"Hello, I would like to order the following items:%0A%0A\";\n\n                document.querySelectorAll('.wc-block-cart-items__row').forEach(item => {\n                    let name = item.querySelector('.wc-block-components-product-name')?.innerText;\n                    let qty = item.querySelector('input[type=\"number\"]')?.value;\n\n                    if (name && qty) {\n                        message += `\u2022 ${name} (Qty: ${qty})%0A`;\n                    }\n                });\n\n                \/\/ Get estimated total value\n                let totalValue = estimatedRow.querySelector('.wc-block-components-totals-item__value')?.innerText;\n\n                if (totalValue) {\n                    message += `%0A\ud83d\udcb0 Estimated Total: ${totalValue}`;\n                }\n\n                let phone = \"6737283881\"; \/\/ \ud83d\udd01 replace with your WhatsApp number\n                window.open(`https:\/\/wa.me\/${phone}?text=${message}`, '_blank');\n            });\n\n            clearInterval(interval);\n        }\n\n    }, 500); \/\/ wait for Woo blocks to load\n\n});\n<\/script>\n\n\n\n<script>\ndocument.addEventListener('click', function(e) {\n    \/\/ Check if the clicked element is the checkout button\n    if (e.target && (e.target.classList.contains('checkout-button') || e.target.closest('.checkout-button'))) {\n        e.preventDefault(); \/\/ Stop the old link from working\n        window.location.href = 'https:\/\/hgxautoparts.com\/?page_id=1167'; \/\/ Force go to your page\n    }\n}, true);\n<\/script>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_eb_attr":"","footnotes":""},"class_list":["post-1166","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/hgxautoparts.com\/index.php?rest_route=\/wp\/v2\/pages\/1166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hgxautoparts.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hgxautoparts.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hgxautoparts.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hgxautoparts.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1166"}],"version-history":[{"count":2,"href":"https:\/\/hgxautoparts.com\/index.php?rest_route=\/wp\/v2\/pages\/1166\/revisions"}],"predecessor-version":[{"id":6385,"href":"https:\/\/hgxautoparts.com\/index.php?rest_route=\/wp\/v2\/pages\/1166\/revisions\/6385"}],"wp:attachment":[{"href":"https:\/\/hgxautoparts.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}