From a11159ef7d7e61143f1203953c66dd8fe3079991 Mon Sep 17 00:00:00 2001 From: Guilherme Carreiro Date: Thu, 14 Nov 2024 13:57:51 +0100 Subject: [PATCH] Remove hidden inputs for product variants --- sections/featured-product.liquid | 3 +-- sections/main-product.liquid | 7 +++++-- snippets/buy-buttons.liquid | 15 +-------------- snippets/card-product.liquid | 9 --------- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/sections/featured-product.liquid b/sections/featured-product.liquid index 8eb489d6c3b..462ac461eb8 100644 --- a/sections/featured-product.liquid +++ b/sections/featured-product.liquid @@ -144,8 +144,7 @@ {%- endif -%} {%- unless placeholder -%}
- {%- form 'product', product -%} - + {%- form 'product', product.selected_or_first_available_variant -%} {{ form | payment_terms }} {%- endform -%}
diff --git a/sections/main-product.liquid b/sections/main-product.liquid index 30890e47acf..9546b5546f2 100644 --- a/sections/main-product.liquid +++ b/sections/main-product.liquid @@ -135,8 +135,11 @@ {%- endif -%}
{%- assign product_form_installment_id = 'product-form-installment-' | append: section.id -%} - {%- form 'product', product, id: product_form_installment_id, class: 'installment caption-large' -%} - + {%- form 'product', + product.selected_or_first_available_variant, + id: product_form_installment_id, + class: 'installment caption-large' + -%} {{ form | payment_terms }} {%- endform -%}
diff --git a/snippets/buy-buttons.liquid b/snippets/buy-buttons.liquid index d2aefae0d9a..b713b1314c6 100644 --- a/snippets/buy-buttons.liquid +++ b/snippets/buy-buttons.liquid @@ -37,25 +37,12 @@ {%- form 'product', - product, + product.selected_or_first_available_variant, id: product_form_id, class: 'form', novalidate: 'novalidate', data-type: 'add-to-cart-form' -%} - - {%- if gift_card_recipient_feature_active -%} {%- render 'gift-card-recipient-form', product: product, form: form, section: section -%} {%- endif -%} diff --git a/snippets/card-product.liquid b/snippets/card-product.liquid index feb720cacb5..cb38873234f 100644 --- a/snippets/card-product.liquid +++ b/snippets/card-product.liquid @@ -345,15 +345,6 @@ novalidate: 'novalidate', data-type: 'add-to-cart-form' -%} -