Shopify themes, liquid, logos, and UX
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.
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, 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 <div> tag
here is an example.
<div class="product-vendor" itemprop="gtin13">
the number would go here
</div>
<div itemprop="sku">
what ever this is
</div>
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?
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024