[FIX] website_sale_aplicoop: force enable cart buttons

This commit is contained in:
snt 2026-03-03 15:09:16 +01:00
parent 6cc0a18de3
commit 62a1c4e1e9

View file

@ -611,6 +611,20 @@
return Math.round(value * factor) / factor;
}
// Safety net: ensure add-to-cart buttons stay enabled in case a stale
// cached template left the "disabled" attribute or a legacy class.
// Stock validation happens server-side on confirm; here we keep the UI usable.
var forceEnableCartButtons = function () {
var buttons = document.querySelectorAll(".add-to-cart-btn");
buttons.forEach(function (btn) {
if (btn.hasAttribute("disabled")) {
btn.removeAttribute("disabled");
}
btn.classList.remove("btn-disabled");
});
};
forceEnableCartButtons();
// ============ ATTACH CHECKOUT BUTTONS (ALWAYS, on any page) ============
// These buttons exist on checkout page, not on cart pages
if (!this._cartCheckoutListenersAttached) {