Shopify themes, liquid, logos, and UX
Hi everyone, could please anyone help me write a snippet liquid code to add onto our product page to showcase the sku number? Pipeline theme doesnt have this function. I tried with adding a liquid block with this: {{ product.sku }} but didnt work.
page: https://www.laurakincade.com/products/pair-of-mauro-large-table-lamps?variant=43560725020822
Hello, @LauraKincade
You should use the SKU attribute of the product variant instead of the product's.
Hey @LauraKincade,
To display the SKU of a product in your Shopify store, ensure that you're showcasing the SKU of the variant rather than that of the product itself. In Shopify, SKUs are associated with variants.
You can use the below liquid code to show the SKU:
{% if product.selected_or_first_available_variant.sku != blank %}
<p class="product-sku">SKU: {{ product.selected_or_first_available_variant.sku }}</p>
{% endif %}
For further understanding of variant objects and SKUs, you can refer to this link from Shopify's documentation: Shopify Variant Object and SKU documentation.
Hope this helps!
Regards,
Abhishek from Swym
Hello, @LauraKincade
You should use the SKU attribute of the product variant instead of the product's.
{{ product.selected_or_first_available_variant.sku }}
If you face any issue let me know
Thanks
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025