Variant.id not updating when use changes selection

We are displaying product variant meta fields for package size and weight, using liquid code on the product page.

However when the use chooses a different variant the variant.id does not change, though it does on the url. If we refresh the page the variant.id does get updated. Is there a call I can make to update the variant.id??

liquid code is

{% for variant in product.variants %}
{% if product.selected_or_first_available_variant.id == variant.id %}
{% assign current = variant.id %}

ID is {{current}}

Package Weight {{ variant.metafields.custom.package_weight }}

Package Dimensions {{ variant.metafields.custom.package_size }}

{% endif %} {% endfor %}

can anyone help