Display product barcode

New Member
1 0 0

Hi guys. Please assist in advising how to go about displaying the barcode of each product on the front end. 

 

I have gotten the SKU to display

0 Likes
Astronaut
1082 147 272

How did you do the sku? I assume it's through the products variant. It's the same with the barcode.

 

{% for variant in product.variants %}
{{ variant.sku }}
{{ variant.barcode }}
{% endfor %}
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
New Member
2 0 1

just to add as it took me a good time to work out and I like to share things in case others have the same question. This is what you need to use in your structured data to display your gtin13 barcode.

 

this should be placed under

"@type": "Product",

 

{% if selected_variant.barcode != blank %}
"gtin13": {{ selected_variant.barcode | json }},
{% endif %}

 

test your product page with the structured data testing tool and look under product for your gtin13 details.

https://search.google.com/structured-data/testing-tool/u/0/

1 Like