Good afternoon everybody,
I would like my online store to display product variants separately:
Example: 1 Product - 3 variants; the three variants to be displayed on the product page.
I don’t want to use the App or duplicate the product for SEO reasons.
Can any kind soul help me with code for this theme?
Hug to everyone
Hi,
Hope the following steps will help you
-
At edit code find the product Template (product.liquid or product-template.liquid file in the “Sections” or “Templates” folder)
-
Find the section where products details and variants are displayed
Something like {{ product | json }} or {{ product.selected_or_first_available_variant | json }}.
- Add code to display Variants Separately
Code example
{% for variant in product.variants %}
{% if variant.featured_image %}
{% else %}
{% endif %}
## {{ product.title }} - {{ variant.title }}
{% if variant.compare_at_price > variant.price %}
{{ variant.compare_at_price | money }}
{% endif %}
{{ variant.price | money }}
{% endfor %}
-
Also use css for style
-
Preview and save, then publish
Note - Backup Your Theme before making changes
Thanks Small_Task_Help,
Which I will chose? I don´t find the product Template (product.liquid or product-template.liquid file in the “Sections” or “Templates” folder)