Skip to main content
Question
WordPress
Asked a question 9 months ago

How do I hide SKUs on product pages in WooCommerce?

Where am I?

In ProjectArmy Community you can ask and answer questions and share your experience with others!

By default, WooCommerce (and Classic Commerce) displays SKUs on product pages. Many small businesses don't use SKUs at all, so their product pages display: SKU: n/a

There's no reason to have that on your product pages, that's why it's a good idea to disable SKUs if you don't use them. It looks cleaner that way.

Disable SKUs Completely

You can disable SKUs completely, which hides them on the product pages as well as in the admin backend when you're adding products. To disable SKUs completely, add the following code snippet to your theme's functions.php file:

add_filter('wc_product_sku_enabled', '__return_false');

This will completely disable SKUs. Please note, you should do this in your child theme. If you make changes to functions.php file and upgrade your theme at a later time, this change will be removed and SKUs will be enabled again. Child theme ensures your customizations are not removed when you upgrade your theme.

Hide SKUs On Product Pages

If you need SKUs for internal use, but want to hide SKUs on product pages so customers don't see them you can do that as well with a modified code snippet:

function pa_hide_skus($enabled){
	if(!is_admin() && is_product()){
		return false;
	}
	return $enabled;
}
add_filter('wc_product_sku_enabled', 'pa_hide_skus');

Keep in mind, you only need one code snippet depending on what you're trying to achieve. So don't add more, pick one and go with that. 

If you need to bring SKUs back again, simply delete the code from your functions.php file and SKUs will return without any issues.

Support can help: If you don't know how to add code to your functions.php file, contact our support to get help. We're happy to do it for you 🙂