Skip to content

Commit

Permalink
Remove product variant hidden inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
karreiro committed Nov 14, 2024
1 parent 5740331 commit 68abb05
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 27 deletions.
3 changes: 1 addition & 2 deletions sections/featured-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@
{%- endif -%}
{%- unless placeholder -%}
<div {{ block.shopify_attributes }}>
{%- form 'product', product -%}
<input type="hidden" name="id" value="{{ product.selected_or_first_available_variant.id }}">
{%- form 'product', product.selected_or_first_available_variant -%}
{{ form | payment_terms }}
{%- endform -%}
</div>
Expand Down
7 changes: 5 additions & 2 deletions sections/main-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@
{%- endif -%}
<div {{ block.shopify_attributes }}>
{%- assign product_form_installment_id = 'product-form-installment-' | append: section.id -%}
{%- form 'product', product, id: product_form_installment_id, class: 'installment caption-large' -%}
<input type="hidden" name="id" value="{{ product.selected_or_first_available_variant.id }}">
{%- form 'product',
product.selected_or_first_available_variant,
id: product_form_installment_id,
class: 'installment caption-large'
-%}
{{ form | payment_terms }}
{%- endform -%}
</div>
Expand Down
15 changes: 1 addition & 14 deletions snippets/buy-buttons.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,12 @@
</div>

{%- form 'product',
product,
product.selected_or_first_available_variant,
id: product_form_id,
class: 'form',
novalidate: 'novalidate',
data-type: 'add-to-cart-form'
-%}
<input
type="hidden"
name="id"
value="{{ product.selected_or_first_available_variant.id }}"
{% if product.selected_or_first_available_variant.available == false
or quantity_rule_soldout
or product.selected_or_first_available_variant == null
%}
disabled
{% endif %}
class="product-variant-id"
>

{%- if gift_card_recipient_feature_active -%}
{%- render 'gift-card-recipient-form', product: product, form: form, section: section -%}
{%- endif -%}
Expand Down
9 changes: 0 additions & 9 deletions snippets/card-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,6 @@
novalidate: 'novalidate',
data-type: 'add-to-cart-form'
-%}
<input
type="hidden"
name="id"
value="{{ card_product.selected_or_first_available_variant.id }}"
class="product-variant-id"
{% if card_product.selected_or_first_available_variant.available == false %}
disabled
{% endif %}
>
<button
id="{{ product_form_id }}-submit"
type="submit"
Expand Down

0 comments on commit 68abb05

Please sign in to comment.