[FIX] website_sale_aplicoop: hard block out-of-stock button
This commit is contained in:
parent
33c148e6a1
commit
eaedf0b421
1 changed files with 18 additions and 0 deletions
|
|
@ -796,6 +796,24 @@
|
|||
var isOutOfStock =
|
||||
(form.getAttribute("data-out-of-stock") || "false") === "true" ||
|
||||
(cartBtn.getAttribute("data-out-of-stock") || "false") === "true";
|
||||
|
||||
// Fallback guards in case cached markup drops the data attribute
|
||||
if (!isOutOfStock) {
|
||||
var btnTitle = (cartBtn.getAttribute("title") || "").toLowerCase();
|
||||
var btnAria = (cartBtn.getAttribute("aria-label") || "").toLowerCase();
|
||||
var iconEl = cartBtn.querySelector("i");
|
||||
var hasBanIcon = iconEl && iconEl.classList.contains("fa-ban");
|
||||
|
||||
if (
|
||||
hasBanIcon ||
|
||||
btnTitle.includes("out of stock") ||
|
||||
btnTitle.includes("sin stock") ||
|
||||
btnAria.includes("out of stock") ||
|
||||
btnAria.includes("sin stock")
|
||||
) {
|
||||
isOutOfStock = true;
|
||||
}
|
||||
}
|
||||
if (isOutOfStock) {
|
||||
var labels = self._getLabels();
|
||||
self._showNotification(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue