Coding

How to Hide SKUs on WooCommerce Product Pages

CommerceCategory
2 min read
Beka Rice

There are a couple of ways we can disable SKUs on the product page: we can remove them from the shop completely, or we can only remove them from the product page.

SKUs are set with the general product data while creating or editing a product:

Create a Product SKU

By default, SKUs are shown on the product page with the product meta:

SKUs on Product Page

If they’re not set, the SKU will just display as SKU: n/a.

This may not be desirable, and most themes leave this information here as-is. WooCommerce doesn’t have a setting to change this, but you can do so via a code snippet.

Remove WooCommerce SKUs Completely

If you don’t need to use SKUs at all in your shop, you can disable them completely by using this code snippet in your custom site plugin or theme’s functions.php:

add_filter( 'wc_product_sku_enabled', '__return_false' );

The SKU will no longer be added to the product page display when disabled.

SKU removed from Product PAge

Not only will the remove SKUs from the product page, but they’ll also be gone from the admin as well.

SKU removed

SKU removed

This option completely removes SKUs from WooCommerce by disabling them throughout your entire site.

Remove WooCommerce SKUs Only on Product Pages

However, I’ve found that most stores want to keep SKUs for administration, but only disable the SKU display on product pages. While you can just hide the SKU with some CSS, here’s a snippet to disable them completely on product pages, but leave them for use in the admin.

function sv_remove_product_page_skus( $enabled ) {
    if ( ! is_admin() && is_product() ) {
        return false;
    }

    return $enabled;
}
add_filter( 'wc_product_sku_enabled', 'sv_remove_product_page_skus' );

This will stop the SKU section from ever being added to the product template, so this change should be virtually theme independent. However, the SKU will still be displayed and editable from the WooCommerce admin.

SKU intact.

This is a great solution for shops that want to manage SKUs, but don’t want to show them to customers while browsing.