If Statement Issue

eyecon
New Member
1 0 0

I am trying to make a conditional widget appear to appear only on product pages where the tag is "Art" and I end up with no widget on respective pages

{% if product.collections == "Art" %}
    <h2 class="product-single__swatch__title h6">
        More ways to view

    </h2>
    <!--start size_position-429 -->{% assign show = false %} {% assign arrays = "" %}{% for collection in product.collections %}{% if arrays contains collection.id %}{% assign show = true %}{% endif%}{% endfor %}{% for locale in shop.published_locales %}{% assign isocode = locale.iso_code %}{% endfor %}{% unless show %}{% for option in product.options_with_values %} {% if option.name == "size" or option.name == "Size" %}{% if option.position == 1 %}{% assign size_position429 = product.selected_or_first_available_variant.option1 | replace: "cm", "" %}{% assign height_var429 = product.selected_or_first_available_variant.option1 | split: 'x' | last | to_integer | replace: "cm", "" %} {% elsif option.position == 2 %} {% assign size_position429 = product.selected_or_first_available_variant.option2 | replace: "cm", "" %} {% assign height_var429 = product.selected_or_first_available_variant.option2 | split: 'x' | last | to_integer | replace: "cm", "" %} {% else %} {% assign size_position429 = product.selected_or_first_available_variant.option3 | replace: "cm", "" %}{% assign height_var429 = product.selected_or_first_available_variant.option3 | split: 'x' | last | to_integer | replace: "cm", "" %} {% endif %}{% endif %}{% endfor %}<artplacer classname="artplacer_clm-429" lang="{{isocode}}" gallery="14356" type="2" artwork_url="{{ product.featured_image | img_url: 'x400' }}" height="{{ height_var429 }}" resizable="false" collection="fine art,abstract,modern" space="3653" text="Sample Room" frames="false" bgcolor="#00b1c9" bordercolor="#00b1c9" fontcolor="#ffffff"></artplacer>{% endunless %}<!--end size_position-429 -->
    <!--start size_position-428 -->{% assign show = false %} {% assign arrays = "" %}{% for collection in product.collections %}{% if arrays contains collection.id %}{% assign show = true %}{% endif%}{% endfor %}{% for locale in shop.published_locales %}{% assign isocode = locale.iso_code %}{% endfor %}{% unless show %}{% for option in product.options_with_values %} {% if option.name == "size" or option.name == "Size" %}{% if option.position == 1 %}{% assign size_position428 = product.selected_or_first_available_variant.option1 | replace: "cm", "" %}{% assign height_var428 = product.selected_or_first_available_variant.option1 | split: 'x' | last | to_integer | replace: "cm", "" %} {% elsif option.position == 2 %} {% assign size_position428 = product.selected_or_first_available_variant.option2 | replace: "cm", "" %} {% assign height_var428 = product.selected_or_first_available_variant.option2 | split: 'x' | last | to_integer | replace: "cm", "" %} {% else %} {% assign size_position428 = product.selected_or_first_available_variant.option3 | replace: "cm", "" %}{% assign height_var428 = product.selected_or_first_available_variant.option3 | split: 'x' | last | to_integer | replace: "cm", "" %} {% endif %}{% endif %}{% endfor %}<artplacer classname="artplacer_clm-428" lang="{{isocode}}" gallery="14356" type="3" artwork_url="{{ product.featured_image | img_url: 'x400' }}" height="{{ height_var428 }}" title="{{ product.title }}" artist="dynamic artist name here" text="Augmented Reality" bgcolor="#00b1c9" bordercolor="#00b1c9" fontcolor="#ffffff"></artplacer>{% endunless %}<!--end size_position-428 -->

{% endif %} 
0 Likes