Want to change variant automatically when click on variant image

I want to change the variant when clicking on the variant image I have found the solution but its only works in select and option but in my theme, I am using input type radio button instead of the select option button.

------------------------------------------Here is my code for the variant-----------------------------------------------------------

{%- if section.settings.product_selector == ‘radio’ -%}
{%- assign isColor = false -%}
{%- assign optionName = option.name | handleize -%}
{%- if optionName contains ‘colo’ -%}
{%- assign isColor = true -%}
{%- endif -%}

{%- assign option_index = forloop.index -%} {%- for value in option.values -%} {%- assign variant_label_state = true -%} {%- if product.options.size == 1 -%} {%- unless product.variants[forloop.index0].available -%} {%- assign variant_label_state = false -%} {%- endunless -%} {%- endif -%} {%- for variant in product.variants %} {%- assign vOption = 'option' | append: option_index -%} {%- if value == variant[vOption] -%} {%- assign currenVariant = variant -%} {%- break -%} {%- endif -%} {%- endfor -%} {%- assign hasImage = false -%} {%- if isColor and currenVariant.image -%} {%- assign hasImage = true -%} {%- endif -%} {%- unless hasImage -%}{{ value | escape }}{%- endunless -%} {%- endfor -%} {%- else -%} {%- endif -%}

---------------------------------------------------Variant Code Ended-----------------------------------------------------------

-----------------------------------------------------------here is the js to change variants---------------------------------------------------

https://help.shopify.com/en/manual/online-store/themes/os/customize/select-variants-click----------------------------------------------------------------------------------------------------

Thanks In Advance if someone helps me to resolve this issue.

@aaqibalighuman

Can you please provide store URL ?

actually, I am working on a copy and don’t want to make it publish . You can see the Brooklyn theme variant style it is the same as my store. Waiting for Your response