Change product barcode with Variant Change on Product Page

Hi All. So I have managed to get my Product Barcode to show on the Product page using the code:

{% assign current_variant = product.selected_or_first_available_variant %}
Product Barcode: {{ current_variant.barcode }}

However on products where there are multiple variants, the barcode doesnt seem to change with the selected variant.

Can anyone help me with what to do in order to get the barcode to update to reflect the selected variant please?

Thanks in Advance.

1 Like

Does anyone have any input please?

Hey- I know this is years old, but did you ever get this sorted? I’m looking to get this working too.
Thanks!