How to Hide Product SKU In WooCommerce

WooCommerce Hide SKU

Do you want to hide SKU on the product page of your WooCommerce store?

In this tutorial, you will learn how to override the single product meta template and delete the SKU on the product page using a custom PHP script.

WooCommerce Hide SKU

WooCommerce is backed up by more than 5 million active installations in the WordPress community.

These numbers continue to grow because WooCommerce is flexible and scalable. In this tutorial, you will see how WooCommerce is flexible for customization.

However, before we start, I recommend that you create a child theme.

When you create one, I recommend creating a functions.php within that child theme as well.

This ensures that no changes you make will be lost during an update.

It is very easy to add the product SKU, as shown below:

Add SKU in the admin area

This is how the SKU is displayed on the product page:SKU in the front end

Steps to Remove WooCommerce SKU Completely

If you don’t need to use SKU 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:

Here are the steps that you need to follow:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to add the function to hide the SKU completely.
  3. Add the following code to the functions.php file:

add_filter( 'wc_product_sku_enabled', '__return_false' );

  1. The SKU will no longer be added to the product page display when disabled, as shown below:Hide WooCommerce SKU
  2. Not only will the code snippet remove SKUs from the product page, but they’ll also be gone from the admin as well, as shown below:Disable SKU in the admin

 

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

WooCommerce Hide SKU Only on the Product Page

Some stores keep SKU for administration, but only disable the SKU display on the product page.

However, you can hide the SKU with some CSS, but you can disable them completely on product pages, and leave them for use in the admin.

Here are the steps that you need to follow:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to add the function to hide the SKU completely on the product page.
  3. Add the following code to the functions.php file:
function njengah_remove_product_page_skus( $enabled ) {

if ( ! is_admin() && is_product() ) {

return false;

}

return $enabled;

}

add_filter( 'wc_product_sku_enabled', 'njengah_remove_product_page_skus' );
  1. This code snippet will stop the SKU section from ever being added to the product template.
  2. This change is virtually theme independent. However, the SKU will still be displayed and edited by the WooCommerce admin, as shown below:Hide WooCommerce SKU

This solution is great for WooCommerce stores that want to manage SKUs, but do not want to show them to customers while browsing.

Conclusion

In this tutorial, you have learned how to hide SKU from your WooCommerce store completely. This option is for store owners who do not need SKU in their shop. Additionally, you have seen how to hide WooCommerce SKU only on the product page. This solution will stop the SKU section from being displayed on the front end. However, it will still be displayed and edited in the admin area.

Similar Articles