EAN Barcode On Product Pages Variant Problems

Topic summary

A user successfully implemented SKU and EAN barcode display on product pages but encountered a variant-switching issue:

Problem:

  • SKU code updates correctly when selecting different product variants
  • EAN barcode remains static and doesn’t change with variant selection

Current Implementation:
The user shared their Liquid code snippet that assigns the current variant and displays both codes using span elements with specific classes.

Status:
The discussion remains open with no solution provided yet. The user is seeking guidance on how to make the EAN code dynamically update like the SKU does when variants are selected.

Summarized with AI on November 21. AI used: claude-sonnet-4-5-20250929.

Hi everybody. I have been searching for how to display SKU code and EAN code on the product pages. I found a way to make those 2 codes display on the product page BUT EAN code is not changing when you select a different variant

SKU code changes with no issues.

Does anybody know how to make it change as SKU does?

This is the code (product.liquid):

{% assign current_variant = product.selected_or_first_available_variant %}
SKU: {{ current_variant.sku }} |
EAN: {{ current_variant.barcode }}