Product Variants Appearing Twice in Variant Picker After Adding Code for Color Swatches

Product Variants Appearing Twice in Variant Picker After Adding Code for Color Swatches

JKW25
Visitor
1 0 1

Hi,

I added color swatches using code. My products that do not have color as a variant option now show duplicates of my other variant in the variant picker. I have included what it currently looks like. I am not familiar with coding, so I am not sure where to look to get rid of the duplicate variant. 

 

I did duplicate my theme before adding the color swatches. However, since adding the color swatch code there have been a number of other changes to my store so reverting back completely to an older version is not something I would like to do. 

 

Thank you!

Screen Shot 2025-04-12 at 2.42.48 PM.png

 

Replies 2 (2)

EcomGraduates
Shopify Partner
840 71 121

You’ll want to go into your theme code and find the file where the swatches were added—usually something like product-form.liquid or main-product.liquid. Inside that file you’ll probably see a loop with something like for option in product.options_with_values.

Right before it starts looping or outputting those swatches, you want to add a check that looks for color only, like this:

 

{% if option.name == 'Color' %}
{% endif %} 

 

 

That way, it only shows the swatches when the option name is actually “Color” and ignores the other options like “Size” or “Allergy.”

 


 If this fixed your issue, likes and accepting as a solution are highly appreciated
|  Build an online presence with our custom-built Shopify Theme: EcomifyTheme
|  Check out our reviews: Trustpilot Reviews
|  We are Shopify Partners: EcomGraduates Shopify Partner



Easify-Jolie
Shopify Partner
268 9 26

Hi @JKW25 

If you’re running into issues with duplicate variants after adding color swatches by code, Easify Product Options can help! It lets you create custom product options (like color swatches, buttons, checkbox, dropdown, etc.) without touching any code — and works independently from Shopify’s default variant system, so no more display bugs or theme conflicts. Easy setup, clean design, and no need to mess with your theme! Here's some examples for you:

  • Clothing Store:

EasifyJolie_0-1744625722986.png

EasifyJolie_2-1744626070830.png

 

  • Jewelry and Accessories Shop

EasifyJolie_1-1744625935176.png

EasifyJolie_3-1744626132796.png

 

  • Butcher Shop

EasifyJolie_5-1744626309527.png

EasifyJolie_4-1744626260583.png

 

I hope this answer helps solve the problem. If you need further assistance, feel free to reach out to Easify anytime! 😊

Easify Product Options: Any product options app can help you create custom options, but Easify turns those options into sales and conversions!
Easify Inventory Sync: Automate inventory syncing for Bundles, Duplicates, and Raw Materials. Say goodbye to manual tracking headaches.
Easify Product Attachments: Enrich your store with downloadable content. Easily add PDFs and other files to product or any page.
>>> Try Apps for Free | 24/7 Live Chat Support