Choosing a selection results in a full page refresh.
Opens in a new window.
liquid
(function () {
var PORTAL = 'https://t1rx-portal.vercel.app/';
var path = window.location.pathname;
// 1) Anyone landing on Shopify's cart or checkout gets sent to the portal.
if (/^\/(cart|checkout)(\/|$)/.test(path)) {
window.location.replace(PORTAL);
return;
}
// 2) Repoint the header cart icon and any other cart/checkout links to the portal.
function repoint() {
document.querySelectorAll('a[href^="/cart"], a[href*="/checkout"]').forEach(function (a) {
a.setAttribute('href', PORTAL);
});
}
// 3) Backstop: block any native form POST to /cart/add.
document.addEventListener('submit', function (e) {
var action = (e.target && e.target.getAttribute('action')) || '';
if (action.indexOf('/cart/add') !== -1) {
e.preventDefault();
e.stopPropagation();
}
}, true);
if (document.readyState !== 'loading') repoint();
document.addEventListener('DOMContentLoaded', repoint);
})();