Envy theme- More Variants in the product page

Topic summary

A user is trying to customize variant selection buttons on their Shopify store (adriabeachwear.com) using the Envy theme, but encounters issues where button-style variants only work for the first option and immediately redirect to cart.

Initial Problem:

  • Custom code displays two variant dropdowns (e.g., “Taglia: slip” sizes and “Taglia: brasiliana” sizes)
  • When styled as buttons instead of dropdowns, only the first variant selector functions correctly
  • Missing JavaScript selectVariant() function causes buttons to submit the form prematurely

Solution Provided:

  • A community member (tim_1) identified the root cause: incomplete JavaScript implementation
  • Provided working code that properly handles variant selection without auto-submitting to cart
  • Included markup for both variant option groups with proper form structure

Follow-up Issue:

  • After a theme update, the original fix stopped working and styling changed
  • Updated code was provided to match the new theme structure and CSS variables
  • User requested minor CSS adjustments to perfectly match original variant styling

Status: Ongoing - user implementing final styling tweaks to align with standard product form appearance.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

I used this code to add variants to my product, but the result is that i can display the variants only as dropdown list. If i display the variants as button, the selection of the variants works only for the first one and send you directly to the cart.

how I can fix this code to display the 2 drop-down list as button.

my url is adriabeachwear.com

And this is the code that I used

Code for the first variant dropdown
{% endcomment %}

Taglia: slip
XXS (36) XS (38) S (40) M (42) L (44)

{% comment %}
Code for the second variant dropdown
{% endcomment %}

Taglia reggiseno
1 2 3 4 5

The code snippet you’ve shared is not complete.

The idea is that when any of these buttons is clicked, browser must execute Javascript function selectVariant with relevant parameter.

However, there is no JS code.

By default, any button inside the form (product form in this case) submits your form with whatever selections are made. And since selectVariant is not defined, buttons perform their default function, same as you click “add to cart”.

You can try this code instead:


    

    
    
    
    
    
    
  

  

    
    
    
    
    
    
  

thank you @tim_1 , your code was working

but now they updated the theme and is not working anymore, and also changed the the style.

what code i need to go back to the same effect of before?

i send a pic where i have opened the console on the “brasiliana” variant (standard from product form)

thank you in advance

Yes, they’ve changed the structure and some CSS variables.

Hope they’ll stick with this for some time…

Try this code instead:


  {% assign form_id = 'product-form-' | append: section.id %}
  

    
    
    
    
    
    
  

  

    
    
    
    
    
    
  

just change the last part to match perfectly the original variants

".line-item-property__field label:has(:checked) {
color: white;
background: black;
}

"