Solved

Show the list of product options in catalog

Delio
Shopify Partner
10 0 0

Hello,

I'm using Dawn theme version 12, I'd like to show, on the catalog page, the list of the options (not variant) for every products (es: size S, M, L, XL; color red, green, blue). Is it possibile adding code on card-product.liquid?

 

I can get the list of variant with this code

 

    {% for variant in card_product.variants %}
      {{ variant.title }}
    {% endfor %}

But can I get the list of options?

Accepted Solution (1)

WebDeskSolution
Shopify Partner
165 42 47

This is an accepted solution.

Hello @Delio 

 

Please use the following liquid code in order to get the list of options:

{% if card_product.options.size > 0 %}
  {% for product_option in card_product.options_with_values %}
   - {{ product_option.name  }} :     
    {% for product_option_val in product_option.values  %}
      {{ product_option_val  }},
    {% endfor %}
  {% endfor %}
{% endif %}

 Please hit Like and Mark it as a Solution if you find our reply helpful.

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Shopify Partner | Hire Us | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9

View solution in original post

Replies 3 (3)

aldy-expatify
Shopify Partner
54 5 10

Hi, @Delio have you tried to visit the documentation from Shopify?
There are view properties you can access in the variant, you can refer to this documentation: https://shopify.dev/docs/api/liquid/objects/variant

If you like our solution, please like and mark it as a solution.
Don't hesitate to reach us for more Shopify solutions. Thanks 🙂
Website: Expatify Indonesia
Email: guru@expatify.co.id
Whatsapp: Whatsapp

WebDeskSolution
Shopify Partner
165 42 47

This is an accepted solution.

Hello @Delio 

 

Please use the following liquid code in order to get the list of options:

{% if card_product.options.size > 0 %}
  {% for product_option in card_product.options_with_values %}
   - {{ product_option.name  }} :     
    {% for product_option_val in product_option.values  %}
      {{ product_option_val  }},
    {% endfor %}
  {% endfor %}
{% endif %}

 Please hit Like and Mark it as a Solution if you find our reply helpful.

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Shopify Partner | Hire Us | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9

Delio
Shopify Partner
10 0 0

Thank you, it works