Shopify themes, liquid, logos, and UX
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!
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
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:
I hope this answer helps solve the problem. If you need further assistance, feel free to reach out to Easify anytime! 😊
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025