Show SKU numbers on product pages

You can show SKU numbers for products or variants by adding some code to your product pages and theme scripts.

Caution

This solution will not work in the Shopify Boundless theme and might not work in third-party themes. If it doesn't work in your third-party theme, please contact your theme author.

Note

You can export a copy of your theme to use as a backup copy.

  1. From your Shopify admin, click Online Store, and then click Themes (or press G W T).

  2. Find the theme you want to edit, click the ... button, and then click Edit HTML/CSS.

  3. Click product.liquid in the Templates folder to open it in the code editor. If you are using a theme that doesn't support sections, then skip the next step.

  4. If you are using a sectioned theme, then find the name of the section template file in theproduct.liquid file:

    Find section file

    Open the section template file in the Sections directory.

  5. Copy the following code:

    
    {% assign current_variant = product.selected_or_first_available_variant %}
    <span class="variant-sku">{{ current_variant.sku }} </span>    
    
    
  6. Paste the code that you copied into your product.liquid file (if you are using a non-sectioned theme) or the section template file (if you are using a sectioned theme). Paste the code wherever you want the SKU to appear.

    This example shows the SKU under the product title in product.liquid:

    Variant sku span placement
  7. Click Save to confirm the changes to your theme files.

On the storefront, your product page will show the SKU under the product title:

Variant sku

Want to discuss this page?

Visit the Shopify Community