Add Barcode to Product Page

lauralonno
New Member
1 0 0

Hi! 

This is my first post and I'm hoping someone can help. I'm looking to add product barcodes (not SKU) to my product page so they're visible for a wholesale buyer needs them to be visible for ease.

I have 6 variants on my products, the barcodes are EAN13 and use the 'District' theme.

I seem to be able to find a lot of references to adding SKUs, but none seem to work for me.

Any help would be greatly appreciated!

Thanks

Reply 1 (1)
JHKCreate
Shopify Partner
2922 504 723

Hi @lauralonno 

To access the product variant's barcode you would need the following code:

{% for variant in product.variants %}
{{ variant.barcode }}
{% endfor %}


However, keep in mind that variant.barcode will display multiple barcodes here, and since you have variants, you would need to setup some JavaScript depending on your theme to track that variant change and change the barcode as well.

Let me know if this helps!

Did we solve your issue? Like & Mark As Solution to help the community | Should you need any direct help: contact@jhkcreate.com
| Learn more about us: jhkcreate.com


| Satisfied with our solutions? Drop a review on Google