Problems with crossing variant button when color is add

Hi!

I want to do this with all products

But when I have a color, it doenst cross the unavaliable variants:

Here is my code for the variants buttons:

{%- assign swatch_file_extension = 'png' -%}
{%- assign is_color = false -%}
{%- assign color_swatch_drop = option_drop -%}
{%- assign color_option_index = 0 -%}

{% if settings.product_color_swatches %}
  {% for option in product.options_with_values %}
    {% if option == color_swatch_drop %}
      {%- assign color_option_index = forloop.index0 -%}
      {%- assign downcased_option = color_swatch_drop.name | downcase -%}
      {% if downcased_option contains 'color' or downcased_option contains 'colour' %}
        {%- assign is_color = true -%}
      {% endif %}
    {% endif %}
  {% endfor %}
{% endif %}

  
  

Anybody knows what is going wrong?

Thanks!

Please send your site and if your site is password protected, please send me the password. I will check it for you.

Hey,

Thanks for taking time on my issue, but I cant do that. Is there another way for the solution?