Hide unneccessory variants on swatch

Topic summary

A Shopify store owner is seeking help with conditional variant display for clothing products. Their store sells items in two options:

The Problem:

  • Stitched option: Requires three size variants (S, M, L)
  • Unstitched option: Should have no size selection
  • Currently, size variants remain visible regardless of which option is selected

Desired Solution:
When customers select “Unstitched,” the size selector should automatically hide or disappear.

Current Status:

  • The user has provided a product link and shared their product form code snippet
  • They’ve attempted multiple solutions without success
  • The code appears corrupted or encoded in the provided snippet, making technical assessment difficult
  • The discussion remains unresolved with the user seeking guidance on implementation

This requires custom JavaScript or Liquid template modifications to conditionally show/hide variant options based on the primary selection.

Summarized with AI on November 24. AI used: claude-sonnet-4-5-20250929.

Hello everyone! We are having a problem when we want to delete having size for one variable of our products.

We are selling cloths and the buyer has two options when buying the cloth. One with a stitched which we have three possible sizes. And another one is Unstitched which we don’t have any variables in size.How could we do it that when you press the button “Unstitched” the size variables disappear? Is there any possible solution? I’ve tried almost everything
site link
https://www.marjjan.com/products/test-afsana-rtw-01?variant=43826493128927
Thank you
Product form code in snippet is mentioned below.

{%- assign product_form_id = 'product-form-' | append: pr_se_id -%}
{%- liquid 
assign pr_variants = product.variants
assign PR_buy_pr = false
if bk_stts.show_dynamic_checkout and isExternal == false and isProductAvailable
  assign PR_buy_pr = true 
endif
assign choose_an_option = 'products.product.choose_an_option' | t
assign date_in = settings.date_in
assign class_frm = 't4s-form__product has--form__swatch'
if isProductDefault
  assign class_frm = 't4s-form__product'
endif
if settings.sticky_atc and type == 'main'
  assign class_frm =  class_frm | append:' is--main-sticky'
else if settings.sticky_atc and type == 'main_sticky'
  assign class_frm =  class_frm | append:' is--atc-sticky'
endif
 
assign color_swatch    = 'disabled-'
assign color_mode      = bk_stts.color_mode
assign selector_mode   = bk_stts.selector_mode
assign stt_color_ck    = settings.color_ck | deafult:';'
assign color_ck        = stt_color_ck | append:',color,colors,couleur,colour' |remove:';,'
assign get_color       = color_ck | downcase | replace: ' ,', ',' | replace: ', ', ',' | split: ',' | uniq
assign color_mode_list = 'color, color is-sw-cl__round, variant_image, variant_image is-sw-cl__round' |split:', '
if color_mode_list contains color_mode
  assign color_swatch  = 'is-sw__color '
endif
assign current_variant_available = current_variant.available
assign use_incoming_mess = settings.use_incoming_mess
assign current_variant_incoming = false
if current_variant.inventory_quantity <= 0 and current_variant.inventory_management == 'shopify' and current_variant.incoming
assign current_variant_incoming = true
endif -%}

{%- if color_mode == 'dropdown' or selector_mode == 'dropdown' %}{% endif -%}

  

    {%- form 'product', product, id: product_form_id, data-productid: product.id, class:class_frm, novalidate: 'novalidate', data-type: 'add-to-cart-form', data-disable-swatch:isProductDefault -%}
        
        {{- form | payment_terms -}}

        {%- if isProductDefault -%}
          
          {%- if advance_pr_type != blank %}{% render 'choose_style', advance_pr_type:advance_pr_type, title:advance_label, pid:product.id %}{% endif -%}

        {%- else -%}

           {{ 'swatch.css' | asset_url | stylesheet_tag }}
           

          

            
            {%- if advance_pr_type != blank %}{% render 'choose_style', advance_pr_type:advance_pr_type, title:advance_label, pid:product.id %}{% endif -%}
              
            {%- for option in product.options_with_values -%}

              {%- liquid 
              assign option_index   = 'option' | append:forloop.index
              assign selected_value = current_variant[option_index]
              assign option_name    = option.name
              assign name_downcase  = option_name | downcase -%}
              
              {%- if get_color contains name_downcase -%}
                
                

                  #### {{option_name}}: {{selected_value | default:choose_an_option }}{% if name_sizeg == name_downcase %}{{html_sizeg}}{% endif %}
                  
                    {%- if color_mode != 'dropdown' -%}
                      {%- for value in option.values -%}
                      
{{ value }}

                      {%- endfor -%}

                    {%- else -%}
                      
                      

                        

                        
                           {{selected_value | default:choose_an_option }}
                           
                        

                        
                           {%- for value in option.values -%}
                           
{{ value }}

                           {%- endfor -%}
                        

                      

                    {%- endif -%}
                  

                

  
              {%- else -%}

                
                  #### {{option_name}}: {{selected_value | default:choose_an_option }}{% if name_sizeg == name_downcase %}{{html_sizeg}}{% endif %}
                  
                    {%- if selector_mode != 'dropdown' -%}
                      {%- for value in option.values -%}
                      
{{ value }}

                        
                      {%- endfor -%}
                      {%- if product.tags contains 'test' -%} 

 **Advance payment has to be made for stitched orders**

{%- endif -%}
       
     
                    {%- else -%}
                      
                      

                        

                        
                           {{selected_value | default:choose_an_option }}
                           
                        

                        
                           {%- for value in option.values -%}
                           
{{ value }}

                           {%- endfor -%}
                        

                      

          
                    {%- endif -%}
                         
                  

                

              {%- endif -%}

            {%- endfor -%}
          

        {%- endif -%}

        {%- if use_incoming_mess and current_variant_incoming and pr_variants.size == 1 and current_variant.next_incoming_date != blank -%}
            {%- assign format_date = current_variant.next_incoming_date | date: date_in -%}
            {% if current_variant_available %}{{ 'products.product_single.will_not_ship_until_html' | t: date:format_date }}{% else %}{{ 'products.product_single.will_be_in_stock_after_html' | t: date:format_date }}{% endif %}

        {%- elsif use_incoming_mess and pr_variants.size > 1 -%}
            {%- liquid
            assign format_date = current_variant.next_incoming_date | date: date_in
            unless format_date 
              assign format_date = '19041994'
            endunless -%}
            {{ 'products.product_single.will_not_ship_until_html' | t: date:format_date }}{{ 'products.product_single.will_be_in_stock_after_html' | t: date:format_date }}

        {%- endif -%}
        {{ 'button-style.css' | asset_url | stylesheet_tag }}
        
        
        {{- html_price -}}
    
         
          

             {%- if isExternal -%}

                {{external_title}}
                {%- if bk_stts.enable_wishlist or bk_stts.enable_compare -%}
                
                {%- render 't4s_wis_cp', product:product, bk_stts:bk_stts -%}
                {%- endif -%}

             {%- else -%}

                {%- if bk_stts.show_qty and isProductAvailable -%}
                
 
                  
                  
                  
                

                {%- else -%}
                 
                {%- endif -%}

                {%- if bk_stts.enable_wishlist or bk_stts.enable_compare -%}
                
                {%- render 't4s_wis_cp', product:product, bk_stts:bk_stts -%}
                {%- endif -%}

                

            {%- endif -%}
          

          {%- if PR_buy_pr and type != 'main_sticky' %}{{- form | payment_button -}}{% endif -%}
          {%- if settings.use_notify_me -%}{%- endif -%}
        

    {%- endform -%}

    {%- unless isProductDefault or type == 'main_sticky' -%}
    
    
    {%- endunless -%}

    {%- if bk_stts.ani != 'none '-%}{%- endif -%}
    
  

 

{%- if PR_buy_pr and current_variant_available != true and type != 'main_sticky' -%}{% endif -%}

Yes please, what should we do to solve this problem?

I am sorry I do not use skype, If it’s convenient for you to talk via mail then that would be great.