From 62a1c4e1e916bdddd4f8160dc47c29150121a955 Mon Sep 17 00:00:00 2001 From: snt Date: Tue, 3 Mar 2026 15:09:16 +0100 Subject: [PATCH] [FIX] website_sale_aplicoop: force enable cart buttons --- .../static/src/js/website_sale.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/website_sale_aplicoop/static/src/js/website_sale.js b/website_sale_aplicoop/static/src/js/website_sale.js index 0e01f88..0acea67 100644 --- a/website_sale_aplicoop/static/src/js/website_sale.js +++ b/website_sale_aplicoop/static/src/js/website_sale.js @@ -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) {