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
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
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 %}
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.
Hi, ive added this code into my template. but the sku and barcode are both on the same line. how can i make it so that they are on 2 seperate lines. sorry im new to all this coding. any help would be appreciated.
thank you
you can wrap each element in a
here is an example.
the number would go here
what ever this is
If I choose a different color/size, the first barcode always shows. How can we get this to update with selected variants?
Nevermind, I found a solution and will post it here to answer that exact question asked by another user.
Hi there,
Wondering where you place this piece of code to have the barcode display?
I am having the same issue today, can you please tell me if you solved it with the actual theme today?