SKU displaying on product page but not changing when the variant is changed

I have recently followed the steps on our website to allow our SKU numbers to display on our product pages.

Shopify Help Center | Show SKU numbers

I have inserted the following code in under ‘product.liquid’, under Section under {{ product.title }} :

{% assign current_variant = product.selected_or_first_available_variant %}
<span class="variant-sku">{{ current_variant.sku }}</span>

This has worked in displaying the SKU. However, when I change the variant on the page, the SKU doesn’t change. Following the steps in the guide above seemed to suggest that this would work.

Any suggestions on what I may have missed?

The code you use is correct.

Now next you have to follow the theme code which changes the price on change of the variant. Understand its logic and use the same to change the sku.
or you can write your own callback function a/to the theme structure.

Thanks Guleria.

How do I follow the theme code so it changes the SKU for the variant?

Analyze the code if you have knowledge of it.

Alternatively ask/hire a developer who can implement your requirement.