On Multiple variation option products the variant image is not showing

I have customized the code in the product-variant-picker.liquid file to show variant images. But I am facing a issue on multiple variation. the issue is on single variation option every thing is working fine the variant image is showing but when i used multiple variation option for a products that time variant image is not showing only variant title text showing. see examples below

Signal variation Product
https://prnt.sc/7PNHCMB8h31S

Multiple variation Product
https://prnt.sc/PSm2JQ0FgiWw

https://prnt.sc/G7iI-LCiCDDA

Below is the my customized code

{% comment %}
Renders product variant-picker

Accepts:

  • product: {Object} product object.
  • block: {Object} passing the block information.
  • product_form_id: {String} Id of the product form to which the variant picker is associated.
  • update_url: {Boolean} whether or not to update url when changing variants. If false, the url isn’t updated. Default: true (optional).
    Usage:
    {% render ‘product-variant-picker’, product: product, block: block, product_form_id: product_form_id %}
    {% endcomment %}

{%- unless product.has_only_default_variant -%}
{%- if block.settings.picker_type == ‘button’ -%}
<variant-radios class=“no-js-hidden” data-section=“{{ section.id }}” data-url=“{{ product.url }}” {{ block.shopify_attributes }}>
{%- for option in product.options_with_values -%}

{{ option.name }} {%- for value in option.values -%} {% assign variant = product.variants | where: 'title', value | first %} {% assign variant_image = variant.image %} {% if variant_image %} {{ value }} {% else %} {% if option.name == "Color" %} {% else %} {{ value }} {% endif %} {% endif %} {%- endfor -%} {%- endfor -%} {%- else -%} {%- for option in product.options_with_values -%}
{{ option.name }}
{% render 'icon-caret' %}
{%- endfor -%} {%- endif -%} {%- endunless -%}
{{- 'products.product.product_variants' | t -}}
{% render 'icon-caret' %}