I'm making a website and it seems that product sku is hidden from product page. I have found how to add it to the catalog (shop) page but I need it to show inside the product page.

So far, by altering the single-product.php, I managed to add it at the end of the page (something we do not want) or before the title on the top left of the page (something we also do not want).

I found no way to add it before the price and below the title of the product.

The code of the themes' single-product.php:

 * Single Product title
 * This template can be overridden by copying it to yourtheme/woocommerce/single-product/title.php.
 * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
 * will need to copy the new files to your theme to maintain compatibility. We try to do this.
 * as little as possible, but it does happen. When this occurs the version of the template file will.
 * be bumped and the readme will list any important changes.
 * @see         http://docs.woothemes.com/document/template-structure/
 * @author  WooThemes
 * @package WooCommerce/Templates
 * @version 1.6.4

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly

<?php echo '<div class="sku">' . $product->sku . '</div>'; ?>

I added the last line.

However, on the theme/woocommerce/single-product/meta.php I can see that sku should be displayed, which is not:

 * Single Product Meta
 * @author      WooThemes
 * @package     WooCommerce/Templates
 * @version     1.6.4

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

global $post, $product;
<div class="product_meta">

    <?php if ( $product->is_type( array( 'simple', 'variable' ) ) && get_option('woocommerce_enable_sku') == 'yes' && $product->get_sku() ) : ?>
        <span itemprop="productID" class="sku"><?php _e('SKU:','qns' ); ?> <?php echo $product->get_sku(); ?>.</span>
    <?php endif; ?>

    <?php echo $product->get_categories( ', ', ' <span class="posted_in">'.__('Category:','qns' ).' ', '.</span>'); ?>

    <?php echo $product->get_tags( ', ', ' <span class="tagged_as">'.__('Tags:','qns' ).' ', '.</span>'); ?>


Any ideas of how I can show the product SKU number inside the product page?

Thanks in advance.


Add this to your functions.php

add_action( 'woocommerce_single_product_summary', 'dev_designs_show_sku', 5 );
function dev_designs_show_sku(){
    global $product;
    echo 'SKU: ' . $product->get_sku();

This will output the product SKU below the product title. See image below. The product SKU is VERTEX-SLVR.

enter image description here

  • AT LAST!!! THANK YOU!!!! Any ideas on how to add the word "SKU:" in front of the SKU number? – CreationP Mar 1 '16 at 20:47
  • NP, I updated the original code to add 'SKU:' before the Product SKU. Could you mark my answer as accepted? Thank you! – Joe Dooley Mar 1 '16 at 20:52
  • Of course. Thank you very much!!! Saved me hours of trouble!! – CreationP Mar 1 '16 at 21:28

Add the following code in your (child) theme's functions.php:

function visupporti_get_product_quantity( $atts ) {

global $product;

$atts = shortcode_atts( array(
'id' => ”,
), $atts );

// If no id, we’re probably on a product page already
if ( empty( $atts['id'] ) ) {

$sku = $product->get_stock_quantity( );

} else {

//get which product from ID we should display a SKU for
$product = wc_get_product( $atts['id'] );
$sku = $product->get_stock_quantity( );



// Only echo if there is a SKU
if ( !empty( $sku ) ) {
echo $sku;

return ob_get_clean();

add_shortcode( 'wc_sku', 'visupporti_get_product_quantity' );

See more details on how to display SKU on the site.

  • What kind of editor did you use to insert those quotes? They have to be replaced with real single ' quotes – Svetoslav Marinov Feb 13 '19 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.