Show Color Variants On Collection Pages As Separate Product

Show Color Variants On Collection Pages As Separate Product

Log in or Sign up to ensure access to purchased code across multiple devices.

How to see the code

1. Please log in/create an account first. This is to ensure that all purchases are connected to an account and can be viewed on different devices.

2. Purchase the code using the "purchase box" on the specific page of the desired code.

3. After the purchase, please refresh the page.

Compatibility: All  Shopify 2.0 FREE themes  ONLYWorks from lower version to version 12

When setting up an e-commerce store, it's important to provide your customers with a clear and comprehensive product page that showcases all available variants. However, sometimes a single product may have multiple variants that differ in color, design, or other features. You can easily separate each variant by its specific feature by using the code below. 

If you do not want to separate the variants by color or any specific feature, you can use the product variant collection for all variants

To implement the secondary image, we can modify your store's liquid code to include the secondary image in the product's HTML markup. This can be done using a conditional statement that checks whether the variant has a secondary image defined in its metafield. If it does, the code will generate an HTML element that displays the image on hover.

We use the following variant metafield below to show a secondary variant image. 

Variant metafield

 

Additionally, you can check out our demo store, which showcases this feature in action. To access our demo store, please use the password 'made4uo'.

What are Show Color Variants On Collection Pages As Separate Product?

Refers to a Shopify code snippet that allows store owners to display each color variant of a product as a separate product on collection pages.

This means that instead of seeing a single product with a list of all the available colors, customers would see each color variant as its own individual product on the collection page. This can be helpful for customers because it makes it easier for them to find the specific variant they are looking for.

Why Use Show Color Variants On Collection Pages As Separate Product?

There are two main reasons why you might want to use the code snippet to show color variants on collection pages as separate products:

  • Improved product browsing: When browsing a collection of products, this can be helpful for customers because it makes it easier for them to see all of the different color options available for each product at a glance. They don't have to click on each individual product to see the available colors.

  • Increased visibility: By showing each variant as a separate product, it can increase the visibility of each color option in your collection. This can be especially beneficial if you have a large number of color variants for a particular product.

Additional Considerations:

 

  • You will need to provide featured images to the variants.
  • Use the metafield variant image to provide hover images.
  • You can choose which option you want to separate using the theme editor.
  • You can hide all variant titles or show only the color title.
  • There is an option to hide the "out of stock" variants, but the filter will only work with products and not variants.

 

What you are buying:

  • A collection of instead products, it will show product variants with color or type (depending on which option you want to show)
  • Will show the first second variant option, e.g. S for size option
  • You will need to provide featured images to the variants
  • Use metafield variant image to provide hover image
  • Assign which option you want to separate using the theme editor
  • Hide all variant title or show color title only
  • Option to hide the "out of stock" variants, not products
  • Filters works with products only therefore it will NOT filter by variant

What makes our code better:

  • We do not use external libraries, with that being said, our code will have no to minimal effect to your website's speed performance
  • We do not leave or add codes use to advertise for our website
  • Our code is mobile friendly

Any issues related to the code will be fix with no additional cost, excluding code customization requests. Simply contact us with "Chat with us." We are just a button away. 

Steps on how to add Show Color Variants On Collection Pages As Separate Product:

Step #1. Open your code editor

From you Admin page, go to Online store, then Themes. Choose the theme you want to edit, then click the three dots, then Edit code.

Step #2. Create a new section file

In Section folder, create a new section, name it collection-variant-color, then replace the default code with the code below.

 

Step #3. Follow the video or create New Collection Template

If you want  to assign this collection template as a default, then follow the video. 

If not, we need to create a new collection template. Open and copy the code in the "collection.json" under the Template folder. Then paste the code to the newly created template. 

Inside the newly created template, find this code "main-collection-product-grid" and replace with the name "collection-variant color".

Step #4. Make a code snippet

We need to make a code snippet. Go to Snippet folder, create a new snippet, name it variant-card.

Step #3. Paste the code

Paste the code below to the newly created snippet. Make sure to SAVE.

Step #4. Customize theme

Go to the theme editor by clicking three dots on your left hand upper corner, then Customize theme. Add a section named "Image side by side". Make sure to SAVE once you are done customizing.

Conclusion

Shopify code snippet that allows you to display color variants of products on collection pages, presenting each variant as a separate product. This can improve product browsing for customers and increase the visibility of your color options.

Copied!
Back to blog

4 comments

Hi SHAYLA,
We updated the product into version 12.Please, check it again. Thanks!

Made4Uo

Will this be updated for Dawn v12.0?

Shayla

Hi,

We can do the installation for you with no extra cost. Just message us using “Chat with us” before purchasing.

Made4Uo

can someone reach out about help us install this as well?

kelsey

Leave a comment