How to hide product SKUs in WooCommerce

In this post, we look at some methods to prevent customers from being able to see product SKUs, while keeping them available for store management purposes.

WooCommerce doesn’t force you to provide an SKU, so it’s possible to avoid showing SKUs by simply not adding them to your products or disabling the feature altogether. Many stores, however, still want the convenience of having SKUs visible in the admin dashboard while keeping them hidden from customers.

There’s a couple of ways to achieve this. The two least elegant methods involve hiding the SKU with CSS (display: none;) or overriding the single product template. Fortunately, there’s a far better method available. Simply add the following code snippet to your theme’s functions.php file.

//Remove SKUs from the front-end 
function lw_remove_product_page_skus( $enabled ) { 
    if ( ! is_admin() && is_product() ) { 
        return false; 
    return $enabled; 
add_filter( 'wc_product_sku_enabled', 'lw_remove_product_page_skus' );

Make sure you’re using a child theme, otherwise this snippet will be removed each time your theme updates.

Shane Gowland

Hi! I’m a web designer, software developer, and digital marketer based in South Australia. I've been building websites on WordPress for over 12 years. You can learn more about the projects and businesses I'm involved with on my website.

Leave a Reply

Free resources for digital entrepreneurs

Get the best web dev, digital marketing and productivity articles sent to your inbox every 3 months.