{"id":26520,"date":"2020-08-20T10:40:35","date_gmt":"2020-08-20T08:40:35","guid":{"rendered":"https:\/\/belvg.com\/blog\/?p=26520"},"modified":"2025-02-11T13:14:55","modified_gmt":"2025-02-11T11:14:55","slug":"shopify-variants","status":"publish","type":"post","link":"https:\/\/belvg.com\/blog\/shopify-variants.html","title":{"rendered":"How to Add Shopify Variants"},"content":{"rendered":"\n<p>In your Shopify store, you can add, display and edit different product variants. This article will provide you with all the information you need to configure custom variants, exceed default capabilities to add more variants and options, hide them if necessary and show variants as separate products. Improve your store with the proven-to-work tips from the BelVG developers!<\/p>\n<p><!--more--><\/p>\n<p><a href=\"#step_1\">Shopify custom variants<br>\n<\/a><a href=\"#step_2\">How to add variants on Shopify<br>\n<\/a><a href=\"#step_3\">How to add more Shopify variants and options than the default ones<br>\n<\/a><a href=\"#step_4\">How to add one Shopify variant or in bulk &amp; add option to existing variant<br>\n<\/a><a href=\"#step_5\">How to hide Shopify variants<br>\n<\/a><a href=\"#step_6\">How to show variants as separate products<\/a><\/p>\n<h2 id=\"step_1\">Shopify custom variants<\/h2>\n<p>By default, on Shopify one product can be presented in three different options. You can select them from the presets offered in the Shopify admin (like size, color, etc.) or set the custom options that you need. The product options, in their turn, can be split into option values: small, medium or large sizes, different colors or material types, and so on. Besides that, you can add text, image and other options to a product using <a href=\"https:\/\/apps.shopify.com\/browse\/store-design-product-options\" rel=\"noopener\" target=\"_blank\">Shopify apps<\/a> only. And one specific combination of different option values makes up one product variant.<\/p>\n<div class=\"module_in_content_container\"><a href=\"https:\/\/belvg.com\/contact\" class=\"link_to_module\" target=\"_blank\" rel=\"noopener\"><\/a><div class=\"module_content\"><img src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/04\/ecommerce-development.png\" width=\"120\" height=\"120\" alt=\"ecommerce development\" class=\"module_image\" title=\"How to Add Shopify Variants\"><div class=\"module_content_part\"><h3 class=\"title\">Build a custom Shopify store with BelVG<\/h3><p class=\"module_content_text\">Can't configure variants yourself? We can help!<\/p><a href=\"https:\/\/belvg.com\/contact\" class=\"link_2_to_module\" target=\"_blank\" style=\"display:inline-block\" rel=\"noopener\"><span class=\"read-more\">Contact us<\/span><\/a><\/div><\/div><\/div>\n<h2 id=\"step_2\">How to add variants on Shopify<\/h2>\n<p>On Shopify, you can add only 100 variants and not more than 3 options to one product. No matter what Plan you use, it is a default setting for all stores on this platform.<\/p>\n<p>When creating a product, you can also create product variants:<\/p>\n<ol>\n<li>In the <strong>variants<\/strong> section, click <strong>Add variant<\/strong>.<\/li>\n<li>Enter a name for the option.<\/li>\n<li>In the <strong>parameter values<\/strong> field, enter the parameter value followed by a comma, for example: S, M, L<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/shopifu-product-variants-configuration.jpg\" alt=\"shopify product variants configuration\" width=\"609\" height=\"530\" class=\"lazy aligncenter size-full wp-image-26522\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"step_3\">How to add more Shopify variants and options than the default ones<\/h2>\n<p>The limit of variants and options can be increased only by using an app from the <a href=\"https:\/\/apps.shopify.com\/search\/query?utf8=%E2%9C%93&amp;q=variants+options\" target=\"_blank\" rel=\"noopener\">Shopify App Store<\/a>.<\/p>\n<p>You can configure your theme code to extract line properties to get custom requirements from your customers if you need to sell a product that has more than 100 variants or 3 options.<\/p>\n<p><strong>Important! Don&rsquo;t forget to save all your files after you change them.<\/strong><\/p>\n<p>Let&rsquo;s see how you can create a new product page template:<\/p>\n<ol>\n<li>From your <strong>Shopify admin<\/strong>, go to <strong>Online Store &gt; Themes<\/strong>.<\/li>\n<li>Find the theme you want to edit, and then click <strong>Actions &gt; Edit code<\/strong>.<\/li>\n<li>In the <strong>Templates<\/strong> directory, click <strong>Add a new template<\/strong>.<\/li>\n<li>Choose product from the drop-down menu, and give your template a name &ldquo;<strong>custom<\/strong>&ldquo;.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/add-variants-on-shopify.jpg\" alt=\"add variants on shopify\" width=\"991\" height=\"422\" class=\"lazy aligncenter size-full wp-image-26523\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>5. Click <strong>Create template<\/strong>. It creates a copy of your<strong> product.liquid<\/strong> template with the name&nbsp;<strong>product.custom.liquid<\/strong>.<\/p>\n<p>6. Find the following line of code:&nbsp;&nbsp;<code>{% section 'product-template' %}<\/code>&nbsp;and replace it with:&nbsp;<code>{% section 'product-custom-template' %}<\/code><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/shopify-product-variants-configure.jpg\" alt=\"shopify product variants configure\" width=\"893\" height=\"610\" class=\"lazy aligncenter size-full wp-image-26524\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>7. In the <strong>Sections<\/strong> directory, click <strong>Add a new section<\/strong>.<\/p>\n<p>8. Give your new section file a name &ldquo;product-custom-template&rdquo;. Click&nbsp;<strong>Create<\/strong> <strong>section<\/strong>.<\/p>\n<p>9. Delete all of the default code so that the file is empty. Copy all of the content from your<strong> product-template.liquid<\/strong> file and paste it into your new <strong>product-custom-template<\/strong> file.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/add-more-shopify-variants-than-the-default.jpg\" alt=\"add more shopify variants than the default\" width=\"810\" height=\"666\" class=\"lazy aligncenter size-full wp-image-26525\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>10. You can add as many custom form fields to your product page as you need. You can use the <a href=\"https:\/\/ui-elements-generator.myshopify.com\/pages\/line-item-property\" target=\"_blank\" rel=\"noopener\">Shopify UI Elements Generator<\/a> tool to easily generate the HTML and Liquid code for each form field that you want to add to your cart page.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/shopify-ui-generator-tool-use.jpg\" alt=\"shopify ui generator tool use\" width=\"635\" height=\"856\" class=\"lazy aligncenter size-full wp-image-26526\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>11. The result code from the generator is inserted into a new <strong>product-custom-template<\/strong> template in a desired place.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/shopify-variants-custom-options.jpg\" alt=\"shopify variants custom options\" width=\"701\" height=\"579\" class=\"lazy aligncenter size-full wp-image-26527\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>12. To display this template, you need to change it for the product.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/change-custom-template-for-shopify-product.jpg\" alt=\"change custom template for shopify product\" width=\"512\" height=\"286\" class=\"lazy aligncenter size-full wp-image-26528\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<\/ol>\n<h2 id=\"step_4\">How to add one Shopify variant or in bulk &amp; add option to existing variant<\/h2>\n<p>To add one variant, you have to click in the <strong>Variants<\/strong> section <strong>Add variant<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/shopify-variants-customization.jpg\" alt=\"shopify variants customization\" width=\"687\" height=\"384\" class=\"lazy aligncenter size-full wp-image-26529\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>To add variants in bulk, you need to duplicate the variant where you want to add a new option. For example, you need to create product variants with a new size S. To do this, you need to select the<strong> Size L<\/strong> &gt; <strong>More action<\/strong> &gt; <strong>Duplicate variants (..in another size)<\/strong> &gt; <strong>Write a new size<\/strong> &gt; <strong>Save<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/duplicate-shopify-variants-for-different-options.gif\" alt=\"duplicate shopify variants for different options\" width=\"512\" height=\"430\" class=\"lazy aligncenter size-full wp-image-26530\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"step_5\">How to hide Shopify variants<\/h2>\n<p>To avoid displaying unavailable combinations of options when a client selects one of the options, you should link these options.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/hide-shopify-options.jpg\" alt=\"hide shopify options\" width=\"882\" height=\"512\" class=\"lazy aligncenter size-full wp-image-26531\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>Follow these steps to link options:<\/p>\n<ol>\n<li>Go to <strong>Online Store &gt; Themes<\/strong>.<\/li>\n<li>Click <strong>Actions &gt; Edit code<\/strong>.<\/li>\n<li>Under Snippets, click the link <strong>Add a new snippet<\/strong>.<\/li>\n<li>Give your new snippet a name&nbsp;&ldquo;<strong>linked-product-options<\/strong>&ldquo;.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/how-to-hide-options-in-product-page-shopify.jpg\" alt=\"how to hide options in product page shopify\" width=\"512\" height=\"181\" class=\"lazy aligncenter size-full wp-image-26532\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>5. In your new snippet file, paste the following code:<\/p>\n<pre class=\"lang:default decode:true\"> \r\n&lt;script&gt;\r\nwindow.addEventListener('DOMContentLoaded', function() {\r\n  var Shopify = Shopify || {};\r\n    \r\n  \/\/ Required functionality from depricated options_selection.js\r\n  Shopify.arrayIncludes = function(e, t) {\r\n    for (var n = 0; n &lt; e.length; n++)\r\n        if (e[n] == t) return !0;\r\n    return !1\r\n  }, Shopify.uniq = function(e) {\r\n      for (var t = [], n = 0; n &lt; e.length; n++) Shopify.arrayIncludes(t, e[n]) || t.push(e[n]);\r\n      return t\r\n  }\r\n\r\n  Shopify.optionsMap = {};\r\n\r\n  Shopify.updateOptionsInSelector = function(selectorIndex) {\r\n      \r\n    switch (selectorIndex) {\r\n      case 0:\r\n        var key = 'root';\r\n        var selector = jQuery('.single-option-selector:eq(0)');\r\n        break;\r\n      case 1:\r\n        var key = jQuery('.single-option-selector:eq(0)').val();\r\n        var selector = jQuery('.single-option-selector:eq(1)');\r\n        break;\r\n      case 2:\r\n        var key = jQuery('.single-option-selector:eq(0)').val();  \r\n        key += ' \/ ' + jQuery('.single-option-selector:eq(1)').val();\r\n        var selector = jQuery('.single-option-selector:eq(2)');\r\n    }\r\n    \r\n    var initialValue = selector.val();\r\n    selector.empty();    \r\n    var availableOptions = Shopify.optionsMap[key];\r\n    for (var i=0; i&lt;availableOptions.length; i++) {\r\n      var option = availableOptions[i];\r\n      var newOption = jQuery('&lt;option&gt;&lt;\/option&gt;').val(option).html(option);\r\n      selector.append(newOption);\r\n    }\r\n    jQuery('.swatch[data-option-index=\"' + selectorIndex + '\"] .swatch-element').each(function() {\r\n      if (jQuery.inArray($(this).attr('data-value'), availableOptions) !== -1) {\r\n        $(this).removeClass('soldout').show().find(':radio').removeAttr('disabled','disabled').removeAttr('checked');\r\n      }\r\n      else {\r\n        $(this).addClass('soldout').hide().find(':radio').removeAttr('checked').attr('disabled','disabled');\r\n      }\r\n    });\r\n    if (jQuery.inArray(initialValue, availableOptions) !== -1) {\r\n      selector.val(initialValue);\r\n    }\r\n    selector.trigger('change');\r\n    \r\n  };\r\n\r\n  Shopify.linkOptionSelectors = function(product) {\r\n    \/\/ Building our mapping object.\r\n    for (var i=0; i&lt;product.variants.length; i++) {\r\n      var variant = product.variants[i];\r\n      if (variant.available) {\r\n        \/\/ Gathering values for the 1st drop-down.\r\n        Shopify.optionsMap['root'] = Shopify.optionsMap['root'] || [];\r\n        Shopify.optionsMap['root'].push(variant.option1);\r\n        Shopify.optionsMap['root'] = Shopify.uniq(Shopify.optionsMap['root']);\r\n        \/\/ Gathering values for the 2nd drop-down.\r\n        if (product.options.length &gt; 1) {\r\n          var key = variant.option1;\r\n          Shopify.optionsMap[key] = Shopify.optionsMap[key] || [];\r\n          Shopify.optionsMap[key].push(variant.option2);\r\n          Shopify.optionsMap[key] = Shopify.uniq(Shopify.optionsMap[key]);\r\n        }\r\n        \/\/ Gathering values for the 3rd drop-down.\r\n        if (product.options.length === 3) {\r\n          var key = variant.option1 + ' \/ ' + variant.option2;\r\n          Shopify.optionsMap[key] = Shopify.optionsMap[key] || [];\r\n          Shopify.optionsMap[key].push(variant.option3);\r\n          Shopify.optionsMap[key] = Shopify.uniq(Shopify.optionsMap[key]);\r\n        }\r\n      }\r\n    }\r\n    \/\/ Update options right away.\r\n    Shopify.updateOptionsInSelector(0);\r\n    if (product.options.length &gt; 1) Shopify.updateOptionsInSelector(1);\r\n    if (product.options.length === 3) Shopify.updateOptionsInSelector(2);\r\n    \/\/ When there is an update in the first dropdown.\r\n    jQuery(\".single-option-selector:eq(0)\").change(function() {\r\n      Shopify.updateOptionsInSelector(1);\r\n      if (product.options.length === 3) Shopify.updateOptionsInSelector(2);\r\n      return true;\r\n    });\r\n    \/\/ When there is an update in the second dropdown.\r\n    jQuery(\".single-option-selector:eq(1)\").change(function() {\r\n      if (product.options.length === 3) Shopify.updateOptionsInSelector(2);\r\n      return true;\r\n    });  \r\n  };\r\n   \r\n  {% if product.available and product.options.size &gt; 1 %}\r\n    var $addToCartForm = $('form[action=\"\/cart\/add\"]');\r\n    if (window.MutationObserver &amp;&amp; $addToCartForm.length) {\r\n      if (typeof observer === 'object' &amp;&amp; typeof observer.disconnect === 'function') {\r\n        observer.disconnect();\r\n      }\r\n      var config = { childList: true, subtree: true };\r\n      var observer = new MutationObserver(function() {      \r\n        Shopify.linkOptionSelectors({{ product | json }});\r\n        observer.disconnect();\r\n      });  \r\n      observer.observe($addToCartForm[0], config);\r\n    }\r\n  {% endif %}\r\n    \r\n  var selector = jQuery('.single-option-selector:eq(0)');\r\n  selector.trigger('change'); \r\n\r\n  {% if product.options.size == 1 %}\r\n    {% for variant in product.variants %}\r\n      {% unless variant.available %}\r\n        jQuery('.single-option-selector option').filter(function() { return jQuery(this).text().trim() === {{ variant.title | json }}; }).remove();\r\n      {% endunless %}\r\n    {% endfor %}\r\n    jQuery('.single-option-selector').trigger('change');\r\n  {% endif %}\r\n});\r\n&lt;\/script&gt;\r\n<\/pre>\n<p>6. Go to the&nbsp;<strong>theme.liquid<\/strong> file.<\/p>\n<p>7. Before the closing &lt;\/body&gt; tag, you need to paste the following code:<\/p>\n<pre class=\"lang:default decode:true\"> {%- if template contains 'product' -%}\r\n    {% render 'linked-product-options' %} \r\n  {%- endif -%}\r\n<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/hide-unavailable-shopify-variant-.jpg\" alt=\"hide unavailable shopify variant\" width=\"536\" height=\"681\" class=\"lazy aligncenter size-full wp-image-26533\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>Here we go! Now only related options are displayed:<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/link-shopify-related-options-.gif\" alt=\"link shopify related options\" width=\"907\" height=\"543\" class=\"lazy aligncenter size-full wp-image-26534\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<h2 id=\"step_6\">How to show variants as separate products<\/h2>\n<p>Now let&rsquo;s separate products according to color variants on the category page:<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/how-to-separate-shopify-product-variants.jpg\" alt=\"how to separate shopify product variants\" width=\"657\" height=\"363\" class=\"lazy aligncenter size-full wp-image-26535\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<ol>\n<li>Open the <strong>collection-template.liquid<\/strong> file&nbsp;in the <strong>Section<\/strong> folder.<\/li>\n<li>Find the following line of code: &lt;ul class=&rdquo;grid grid&ndash;uniform{% if collection.products_count &gt; 0 %} grid&ndash;view-items{% endif %}&rdquo;&gt;<\/li>\n<li>And inside the ul tag delete the whole code and paste this one:<\/li>\n<\/ol>\n<pre class=\"lang:default decode:true\">{% for product in collection.products %}\r\n        {% if product.variants.size &gt; 1 %}\r\n        {% for option in product.options %}\r\n           {% if option == 'Color' %}\r\n           {% assign index = forloop.index0 %}\r\n           {% assign colorlist = '' %}\r\n           {% assign color = '' %}\r\n           {% for variant in product.variants %}\r\n           {% capture color %}\r\n           {{ variant.options[index] }}\r\n           {% endcapture %}\r\n             {% unless colorlist contains color %}\r\n             &lt;li class=\"grid__item grid__item--{{section.id}} {{ grid_item_width }}\"&gt;\r\n                {% include 'product-card-grid-variants', max_height: max_height, product: product, show_vendor: section.settings.show_vendor %}\r\n              &lt;\/li&gt;\r\n                {% capture tempList %}\r\n              {{colorlist | append: color | append: \" \" }}\r\n              {% endcapture %}\r\n              {% assign colorlist = tempList %}\r\n              {% endunless %}\r\n              {% endfor %}\r\n            {% endif %}\r\n          {% endfor %}\r\n        {% else %}\r\n         &lt;li class=\"grid__item grid__item--{{section.id}} {{ grid_item_width }}\"&gt;\r\n            {% include 'product-card-grid', max_height: max_height, product: product, show_vendor: section.settings.show_vendor %}\r\n          &lt;\/li&gt;\r\n        {% endif %}\r\n        {% endfor %}\r\n<\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/separate-shopify-product-variants-by-category.jpg\" alt=\"separate shopify product variants by category\" width=\"1279\" height=\"680\" class=\"lazy aligncenter size-full wp-image-26536\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<p>4. Create a new&nbsp;<strong>product-card-grid-variants.liquid<\/strong> snippet&nbsp;in the <strong>Snippet<\/strong> folder.<\/p>\n<p>5. Insert the following code there:<\/p>\n<pre class=\"lang:default decode:true\">{% comment %}\r\n    Renders a product card using \"Grid\" style\r\n    Accepts:\r\n    - max_height: {Number} Maximum height of the product's image (required)\r\n    - product: {Object} Product Liquid object (required)\r\n    - show_vendor: {Boolean} Show the product's vendor depending on the section setting (optional)\r\n\r\n    Usage:\r\n    {% include 'product-card-grid', max_height: max_height, product: product, show_vendor: section.settings.show_vendor %}\r\n{% endcomment %}\r\n&lt;div class=\"grid-view-item{% unless product.available %} grid-view-item--sold-out{% endunless %} product-card\"&gt;\r\n  &lt;a class=\"grid-view-item__link grid-view-item__image-container full-width-link\" href=\"{{ product.url | within: collection }}\"&gt;\r\n    &lt;span class=\"visually-hidden\"&gt;{{ product.title }}&lt;\/span&gt;\r\n  &lt;\/a&gt;\r\n\r\n  {% capture img_id %}ProductCardImage-{{ section.id }}-{{ product.id }}{% endcapture %}\r\n  {% capture wrapper_id %}ProductCardImageWrapper-{{ section.id }}-{{ product.id }}{% endcapture %}\r\n  {%- assign preview_image = variant.image -%}\r\n  {%- assign img_url = preview_image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}\r\n\r\n  {% unless preview_image == blank %}\r\n    {% include 'image-style', image: preview_image, height: max_height, wrapper_id: wrapper_id, img_id: img_id %}\r\n  {% endunless %}\r\n\r\n  &lt;div class=\"product-card__image-with-placeholder-wrapper\" data-image-with-placeholder-wrapper&gt;\r\n    &lt;div id=\"{{ wrapper_id }}\" class=\"grid-view-item__image-wrapper product-card__image-wrapper js\"&gt;\r\n      &lt;div style=\"padding-top:{% unless preview_image == blank %}{{ 1 | divided_by: preview_image.aspect_ratio | times: 100 }}%{% else %}100%{% endunless %};\"&gt;\r\n        &lt;img id=\"{{ img_id }}\"\r\n              class=\"grid-view-item__image lazyload\"\r\n              alt=\"{{ preview_image.alt }}\"\r\n              data-src=\"{{ img_url }}\"\r\n              data-widths=\"[180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 2048]\"\r\n              data-aspectratio=\"{{ preview_image.aspect_ratio }}\"\r\n              data-sizes=\"auto\"\r\n              data-image&gt;\r\n      &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n    &lt;div class=\"placeholder-background placeholder-background--animation\" data-image-placeholder&gt;&lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n\r\n  &lt;noscript&gt;\r\n    {% capture image_size %}{{ max_height }}x{{ max_height }}{% endcapture %}\r\n    &lt;img class=\"grid-view-item__image\" src=\"{{ preview_image | img_url: image_size, scale: 2 }}\" alt=\"{{ preview_image.alt }}\" style=\"max-width: {{ max_height | times: preview_image.aspect_ratio }}px;\"&gt;\r\n  &lt;\/noscript&gt;\r\n\r\n  &lt;div class=\"h4 grid-view-item__title product-card__title\" aria-hidden=\"true\"&gt;{{ product.title }} - {{ variant.option2 }}&lt;\/div&gt;\r\n\r\n  {% include 'product-price-listing', product: variant, show_vendor: show_vendor %}\r\n\r\n&lt;\/div&gt;<\/pre>\n<p>Well done! The category page now has its products separated by color.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/belvg.com\/wp-content\/uploads\/2019\/06\/pixel.png\" data-src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/shopify-product-options-sorted-by-color.jpg\" alt=\"shopify product options sorted by color\" width=\"774\" height=\"765\" class=\"lazy aligncenter size-full wp-image-26537\" title=\"How to Add Shopify Variants\"><\/p>\n<p>&nbsp;<\/p>\n<div class=\"module_in_content_container\"><a href=\"https:\/\/belvg.com\/contact\" class=\"link_to_module\" target=\"_blank\" rel=\"noopener\"><\/a><div class=\"module_content\"><img src=\"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2015\/04\/ecommerce-development.png\" width=\"120\" height=\"120\" alt=\"ecommerce development\" class=\"module_image\" title=\"How to Add Shopify Variants\"><div class=\"module_content_part\"><h3 class=\"title\">Build a custom Shopify store with BelVG<\/h3><p class=\"module_content_text\">Can't configure variants yourself? We can help!<\/p><a href=\"https:\/\/belvg.com\/contact\" class=\"link_2_to_module\" target=\"_blank\" style=\"display:inline-block\" rel=\"noopener\"><span class=\"read-more\">Contact us<\/span><\/a><\/div><\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"In your Shopify store, you can add, display and edit different product variants. This article &#8230;","protected":false},"author":72,"featured_media":26521,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_acf_changed":false,"footnotes":""},"categories":[474,602],"tags":[],"class_list":["post-26520","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-ecommerce","category-shopify","post_format-image"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Want to learn how to configure Shopify variants? Here is your guide! Create custom variants, exceed default Shopify capabilities, show variants as separate products and more\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Ivan Orlovsky\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/belvg.com\/blog\/shopify-variants.html\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#article\",\"name\":\"How to Add Shopify Variants | BelVG Blog\",\"headline\":\"How to Add Shopify Variants\",\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/ivan-orlovsky#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/how-to-add-shopify-variants-to-your-store.jpg\",\"width\":1108,\"height\":590,\"caption\":\"how to add shopify variants to your store\"},\"datePublished\":\"2020-08-20T10:40:35+02:00\",\"dateModified\":\"2025-02-11T13:14:55+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#webpage\"},\"articleSection\":\"ECOMMERCE, Shopify, Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/ecommerce#listItem\",\"name\":\"ECOMMERCE\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/ecommerce#listItem\",\"position\":2,\"name\":\"ECOMMERCE\",\"item\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/ecommerce\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#listItem\",\"name\":\"How to Add Shopify Variants\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#listItem\",\"position\":3,\"name\":\"How to Add Shopify Variants\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/category\\\/ecommerce#listItem\",\"name\":\"ECOMMERCE\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/ivan-orlovsky#author\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/ivan-orlovsky\",\"name\":\"Ivan Orlovsky\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1b3037bcae6f612a77ceb345fe5dcb9a0f1be740692a7a9e4be8db354247919c?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Ivan Orlovsky\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#webpage\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html\",\"name\":\"How to Add Shopify Variants | BelVG Blog\",\"description\":\"Want to learn how to configure Shopify variants? Here is your guide! Create custom variants, exceed default Shopify capabilities, show variants as separate products and more\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/ivan-orlovsky#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/author\\\/ivan-orlovsky#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/how-to-add-shopify-variants-to-your-store.jpg\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html\\\/#mainImage\",\"width\":1108,\"height\":590,\"caption\":\"how to add shopify variants to your store\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/shopify-variants.html#mainImage\"},\"datePublished\":\"2020-08-20T10:40:35+02:00\",\"dateModified\":\"2025-02-11T13:14:55+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/belvg.com\\\/blog\\\/\",\"name\":\"BelVG Blog\",\"description\":\"Magento and Prestashop articles\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/belvg.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to Add Shopify Variants | BelVG Blog","description":"Want to learn how to configure Shopify variants? Here is your guide! Create custom variants, exceed default Shopify capabilities, show variants as separate products and more","canonical_url":"https:\/\/belvg.com\/blog\/shopify-variants.html","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#article","name":"How to Add Shopify Variants | BelVG Blog","headline":"How to Add Shopify Variants","author":{"@id":"https:\/\/belvg.com\/blog\/author\/ivan-orlovsky#author"},"publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/how-to-add-shopify-variants-to-your-store.jpg","width":1108,"height":590,"caption":"how to add shopify variants to your store"},"datePublished":"2020-08-20T10:40:35+02:00","dateModified":"2025-02-11T13:14:55+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#webpage"},"isPartOf":{"@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#webpage"},"articleSection":"ECOMMERCE, Shopify, Image"},{"@type":"BreadcrumbList","@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/belvg.com\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/ecommerce#listItem","name":"ECOMMERCE"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/ecommerce#listItem","position":2,"name":"ECOMMERCE","item":"https:\/\/belvg.com\/blog\/category\/ecommerce","nextItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#listItem","name":"How to Add Shopify Variants"},"previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#listItem","position":3,"name":"How to Add Shopify Variants","previousItem":{"@type":"ListItem","@id":"https:\/\/belvg.com\/blog\/category\/ecommerce#listItem","name":"ECOMMERCE"}}]},{"@type":"Organization","@id":"https:\/\/belvg.com\/blog\/#organization","name":"BelVG Blog","description":"Magento and Prestashop articles","url":"https:\/\/belvg.com\/blog\/"},{"@type":"Person","@id":"https:\/\/belvg.com\/blog\/author\/ivan-orlovsky#author","url":"https:\/\/belvg.com\/blog\/author\/ivan-orlovsky","name":"Ivan Orlovsky","image":{"@type":"ImageObject","@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/1b3037bcae6f612a77ceb345fe5dcb9a0f1be740692a7a9e4be8db354247919c?s=96&d=mm&r=g","width":96,"height":96,"caption":"Ivan Orlovsky"}},{"@type":"WebPage","@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#webpage","url":"https:\/\/belvg.com\/blog\/shopify-variants.html","name":"How to Add Shopify Variants | BelVG Blog","description":"Want to learn how to configure Shopify variants? Here is your guide! Create custom variants, exceed default Shopify capabilities, show variants as separate products and more","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/belvg.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#breadcrumblist"},"author":{"@id":"https:\/\/belvg.com\/blog\/author\/ivan-orlovsky#author"},"creator":{"@id":"https:\/\/belvg.com\/blog\/author\/ivan-orlovsky#author"},"image":{"@type":"ImageObject","url":"https:\/\/belvg.com\/blog\/wp-content\/uploads\/2020\/08\/how-to-add-shopify-variants-to-your-store.jpg","@id":"https:\/\/belvg.com\/blog\/shopify-variants.html\/#mainImage","width":1108,"height":590,"caption":"how to add shopify variants to your store"},"primaryImageOfPage":{"@id":"https:\/\/belvg.com\/blog\/shopify-variants.html#mainImage"},"datePublished":"2020-08-20T10:40:35+02:00","dateModified":"2025-02-11T13:14:55+02:00"},{"@type":"WebSite","@id":"https:\/\/belvg.com\/blog\/#website","url":"https:\/\/belvg.com\/blog\/","name":"BelVG Blog","description":"Magento and Prestashop articles","inLanguage":"en-US","publisher":{"@id":"https:\/\/belvg.com\/blog\/#organization"}}]}},"aioseo_meta_data":{"post_id":"26520","title":null,"description":"Want to learn how to configure Shopify variants? Here is your guide! Create custom variants, exceed default Shopify capabilities, show variants as separate products and more","keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-11-03 18:36:26","updated":"2026-11-03 18:36:26"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/belvg.com\/blog\/category\/ecommerce\" title=\"ECOMMERCE\">ECOMMERCE<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow to Add Shopify Variants\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/belvg.com\/blog\/"},{"label":"ECOMMERCE","link":"https:\/\/belvg.com\/blog\/category\/ecommerce"},{"label":"How to Add Shopify Variants","link":"https:\/\/belvg.com\/blog\/shopify-variants.html"}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/26520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/users\/72"}],"replies":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/comments?post=26520"}],"version-history":[{"count":-5,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/posts\/26520\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media\/26521"}],"wp:attachment":[{"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/media?parent=26520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/categories?post=26520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/belvg.com\/blog\/wp-json\/wp\/v2\/tags?post=26520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}