Craft theme version 9 featured product image

I recently updated to craft theme 9. When i click on product it opens up with first variant image rather than the featured product image. Please can someone let me know how to fix that.

@RA86 add below condition to the main-product.liquid file where featured image code

{%- if product.selected_or_first_available_variant.featured_media != null -%}

{% endif %}

I see slightly different code