[FIX] website_sale_aplicoop: block out-of-stock add
This commit is contained in:
parent
9bd48654fd
commit
33c148e6a1
3 changed files with 32 additions and 3 deletions
|
|
@ -792,6 +792,19 @@
|
|||
var quantityInput = form.querySelector(".product-qty");
|
||||
var quantity = quantityInput ? parseFloat(quantityInput.value) : 1;
|
||||
|
||||
// Block add-to-cart if product is flagged out of stock (from template)
|
||||
var isOutOfStock =
|
||||
(form.getAttribute("data-out-of-stock") || "false") === "true" ||
|
||||
(cartBtn.getAttribute("data-out-of-stock") || "false") === "true";
|
||||
if (isOutOfStock) {
|
||||
var labels = self._getLabels();
|
||||
self._showNotification(
|
||||
labels.out_of_stock || "Product is out of stock",
|
||||
"warning"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Adding:", {
|
||||
productId: productId,
|
||||
productName: productName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue