How can I modify code to show data for only the selected variant?

Hello,

I am using refresh 2.0
{% if product.selected_or_first_available_variant.title != blank -%}
{% assign brand-info = shop.metaobjects.brand.values %}
{% for brand in brand-info %}
Brand: {{ brand.name }}

Website: {{ brand.website }}

{% endfor %}
{%- endif %}

The above code will return multiple brand names and websites etc, they are linked to a metaobject.
What change do I need to make so that it only shows data for the selected variant???

Please bear with me as I am new to coding

Thank You!

1 Like

Hi @HaseebAdnan

You need a javascript code to listen to user’s input. That will hide and show the brand and website to appropriate variant. If you are not well verse with javascript, I would suggest to hire a developer to write the code for you

Thanks for replying.

I am not well versed with javascript but neither do I want to hire a developer.

Can you give me an example with dummy values of what I am supposed to do?
I saw somewhere that they were looping every 1000 ms or so but I lost link to that post.