Why are my color swatches adding the wrong product to the cart?

Hi all. I am just adding colour swatches to my products on my store. However when I select a colour swatch it still just adds the same one colour to the cart. For example. If I select the grey colour swatch it still adds the product in beige colour to the cart.

You can view the product I am testing on here: https://floorzy.com/products/apollo-plus-burly-wood

*store pass is: voghai

You can also view my colour swatch code here:


        {%- case option_selector_type -%}
          {%- when 'color' -%}
            {{ option.name }}: {{ option.selected_value }}

            

              {%- assign color_swatch_config = settings.color_swatch_config | newline_to_br | split: '
' -%}

              {%- for value in option.values -%}
                {%- assign downcased_value = value | downcase -%}
                {%- capture color_id -%}{{ option_name }}-{{ forloop.index }}{%- endcapture -%}

                

                  
                  
                

              {%- endfor -%}
            

          {%- when 'variant' -%}
            {{ option.name }}: {{ option.selected_value }}

            

              {%- capture option_name -%}option{{ option.position }}{%- endcapture -%}

              {%- for value in option.values -%}
                {%- capture variant_swatch_id -%}{{ option_name }}-{{ forloop.index }}{%- endcapture -%}

                {%- for variant in product.variants -%}
                  {%- if variant[option_name] == value and variant.image -%}
                    

                      

                      
                    

                    {%- break -%}
                  {%- endif -%}
                {%- endfor -%}
              {%- endfor -%}
            

          {%- when 'block' -%}
            {{ option.name }}: {{ option.selected_value }}

            

              {%- for value in option.values -%}
                {%- capture block_swatch_id -%}{{ option_name }}-{{ forloop.index }}{%- endcapture -%}

                

                  
                  
                

              {%- endfor -%}
            

          {%- when 'select' -%}
            

            

              {%- render 'icon', icon: 'arrow-bottom' -%}

              
            

        {%- endcase -%}
      

Thanks in advance for any help!