From b93c5901dc55cd509d43304ec1ef99ca00b60c92 Mon Sep 17 00:00:00 2001 From: Rob de Kort Date: Thu, 17 Sep 2026 16:05:03 +0200 Subject: [PATCH] Update alpine.js Fix error when a product is out of stock and there's no `[name="ss-product-variant"]` --- resources/js/shopify/alpine.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/js/shopify/alpine.js b/resources/js/shopify/alpine.js index 4dd31bd..f657a6d 100644 --- a/resources/js/shopify/alpine.js +++ b/resources/js/shopify/alpine.js @@ -104,7 +104,10 @@ const createData = (Alpine) => { } this.selectedVariant = variants[0]; - this.variantEl.value = this.selectedVariant.slug; + + if (this.variantEl) { + this.variantEl.value = this.selectedVariant.slug; + } for (const [key, value] of Object.entries(options)) { this.selected[key] = this.selectedVariant[key];