Re: Add Variant Metafield to add different description

Add Variant Metafield to add different description

purwajmiyani
Tourist
11 0 2

I have the product that has two (2) variants so I want to add different description to different variant in the collapsible row.

 
 
 
Replies 4 (4)

yash_m
Shopify Partner
2 0 0

Hey @purwajmiyani  
Shopify's native interface doesn't provide a built-in feature for separate variant descriptions. You'll need to use custom coding to achieve this.

purwajmiyani
Tourist
11 0 2

@yash_m Can you Please provide me a custom code for it?

 

deepaksharma
Shopify Partner
449 63 99

Hey @purwajmiyani 

 

You can obtain this feature by creating metafields and adding the description in it, metafield is built in feature of shopify and wll help you add custom dynamic block in to your store

 

You can take guide from this video

 

If you are unable to implement the same then I'm happy to do this for you, let me know. I can implement the code changes so that this will work well for you.

 

Hopefully, it will help you. If yes then Please don't forget to hit Like and Mark it as the solution!

Deepak Sharma || Shopify Developer || Helping eCommerce Stores
- Was my reply helpful? Accept it as solution
- Was your question answered? Mark it as an Accepted Solution.
-CHAT ON WHATSAPP | BUY ME A COFFEE | MAIL ME: [email protected]

hamzaadeel
Shopify Partner
11 2 4

{%
if product.has_only_default_variant == false %}
{{product.selected_or_first_available_variant.metafields.custom.variant_quanity_description}
{% endif %}


you need to create the variant based metafields and then you can add there the description of both separately and write this code  in this where the accordion content is rendering
{%- when 'description' -%}
<div class="accordion__content rte" id="ProductAccordion-{{ block.id }}-{{ section.id }}">
{% if product.has_only_default_variant == false %}
{{product.selected_or_first_available_variant.metafields.custom.variant_quanity_description}
{% endif %}
</div>