Shopify themes, liquid, logos, and UX
How do I display the SKU on the product page (using Dawn theme)? Isn't it already a metafield? Why doesn't SKU show up as a metafield when I got to edit metafields?
Solved! Go to the solution
This is an accepted solution.
{% for variant in product.variants %}
{% if product.selected_or_first_available_variant.id == variant.id %}
<strong>SKU: {{ variant.sku }} </strong>
{% endif %}
{% endfor %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$(".no-js-hidden").on("click", function(){
var refreshint = setInterval(function(){
location.reload();
}, 1000); }); });
</script>
Add this code where you want to show the SKU.
@adventmedia
There is an already option to display and add the SKU from your Admin panel.
Let me know if you need help to add the Sku in your Product page.
We will happy to help you.
Thank you.
Where? Can the position of the SKU be moved on the product page? It does not appear in the customizer as far as I can see.
Yeah, I know where to input the SKU in the admin. What I want to know is how to make it display in the product page.
@adventmedia
Follow this link you will get it.
If you can't able to add it then you need to hire a developer,
https://help.shopify.com/en/manual/online-store/themes/themes-by-shopify/vintage-themes/customizing-...
thank you.
@adventmedia May this help you. Click here
NO that does not help. I already looked at it and it does not show anything for Shopify 2.0.
Please refer this. Click here
The link show how to show the sku on product page.
Why do you post the same link that is not a solution for Shopify 2.0?
This is an accepted solution.
{% for variant in product.variants %}
{% if product.selected_or_first_available_variant.id == variant.id %}
<strong>SKU: {{ variant.sku }} </strong>
{% endif %}
{% endfor %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$(".no-js-hidden").on("click", function(){
var refreshint = setInterval(function(){
location.reload();
}, 1000); }); });
</script>
Add this code where you want to show the SKU.
Which template file? Dawn theme.
@adventmedia
Product.template.liquid or where you want to Show it,
Find the file and add it.
also you could customize the theme (Dawn 2.0 in this example) by adding a 'custom liquid' block on your product template page. I added this exact code into the window and the sku popped up.
Please experts tell us if this is not efficient.
How do I implement this without it reloading the page every single time?
Perfect, thank you! Done 😁
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024