add to cart button disabled when 0 stock and newsletter form theming

This commit is contained in:
elvira
2026-09-25 20:23:22 +03:00
parent 081893ef57
commit ab7e560a3d
8 changed files with 64 additions and 21 deletions
@@ -109,6 +109,9 @@ private function buildOptionPicker(int $productId): array
'id' => $variant->id,
'price' => $variant->prices->first()?->price?->decimal(),
'image' => $variant->images->first()?->getUrl(),
// Live from the DB (not the index's in_stock), with Lunar's own
// purchasability rule — drives the disabled add-to-cart button.
'inStock' => $variant->canBeFulfilledAtQuantity(1),
// handle => selected value id, for matching a combination of
// selections back to this variant — see selectVariant() in
// product-form-controller.js.