← Back to Snippets
SKU Display
Shows the product SKU on the product page, updating dynamically when variants change. Clean, minimal display that integrates with any theme layout.
snippets/plynthr-sku-display.liquid
{% comment %}
Plynthr — SKU Display
https://plynthr.com/snippets/sku-display/
INSTALL:
1. Create snippets/plynthr-sku-display.liquid
2. Paste this code
3. Add {%- render 'plynthr-sku-display' -%} in your product template
{% endcomment %}
<style>
.plynthr-sku {
font-size: 12px;
color: var(--plynthr-sku-color, #999);
margin: 4px 0 12px;
font-variant-numeric: tabular-nums;
}
.plynthr-sku__label {
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--plynthr-sku-label-color, #666);
}
</style>
{%- if template.name == 'product' -%}
{%- assign current_variant = product.selected_or_first_available_variant -%}
{%- if current_variant.sku != blank -%}
<p class="plynthr-sku" id="plynthr-sku">
<span class="plynthr-sku__label">SKU:</span>
<span id="plynthr-sku-value">{{ current_variant.sku }}</span>
</p>
{%- endif -%}
<script>
(() => {
const skuEl = document.getElementById('plynthr-sku');
const skuValue = document.getElementById('plynthr-sku-value');
if (!skuEl || !skuValue) return;
const skus = {
{%- for variant in product.variants -%}
"{{ variant.id }}": "{{ variant.sku | escape }}"{% unless forloop.last %},{% endunless %}
{%- endfor -%}
};
document.addEventListener('change', (e) => {
if (e.target.name === 'id' || e.target.matches('[data-variant-id]')) {
const sku = skus[e.target.value];
if (sku) {
skuValue.textContent = sku;
skuEl.style.display = '';
} else {
skuEl.style.display = 'none';
}
}
});
})();
</script>
{%- endif -%}
Installation
- In your Shopify admin, go to Online Store → Themes → Edit Code
- Under Snippets, click "Add a new snippet"
- Name it
plynthr-sku-display - Paste the code above and save
- Open your product template (e.g.,
sections/main-product.liquid) - Add
{%- render 'plynthr-sku-display' -%}where you want the SKU to appear (usually below the price or above the variant selector)
Customization
--plynthr-sku-color— SKU text color (default: #999)--plynthr-sku-label-color— "SKU:" label color (default: #666)- Change the font-size in the CSS to match your theme
Want this installed for you?
I'll add this to your Shopify store, test it, and make sure it's working perfectly. Done within 24 hours.
Install for Me — $29
✓ Installed & tested
✓ Within 24 hours
✓ Any OS 2.0 theme
FAQ
Does it update when I change variants?
Yes. The SKU updates dynamically when the customer selects a different variant, using the variant's ID to look up the correct SKU.
What if a variant doesn't have a SKU?
The snippet hides itself automatically if the selected variant has no SKU assigned.
My SKUs aren't showing at all
Make sure your products have SKUs assigned in the Inventory section of each variant in Shopify admin.