Variant product to the cart only add the first option

Topic summary

Issue: Selecting a variant added the first variant to cart across all products in a Shopify “Boost” theme store (example link provided). The problem appeared recently; code for main-product.liquid was shared.

Root cause: A custom quantity drop-down introduced an extra/nested form and removed required elements from the main Shopify product form. This broke variant submission, causing the default (first) variant to be added.

Fix: Restore a single, proper Shopify product form (e.g., {% form 'product', product, id: product_form_id, class: form_class %}) and remove the additional form around the quantity control.

Outcome: After applying the change, variant selection and add-to-cart behavior worked correctly across tested products.

Status: Resolved. Further improvements were mentioned as possible but not detailed.

Summarized with AI on December 24. AI used: gpt-5.

I’d try to replace this:


  {%- form 'product', product, id: product_form_id, class: form_class -%}

With this:

{%- form 'product', product, id: product_form_id, class: form_class -%}
  
  
  

  

Whoever added the quantity drop-down has created an extra form and removed required elements from the main cart form…

There are other possible improvements, but start with this.

1 Like