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:
This is how the SKU is displayed on the product page:
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:
- Log into your WordPress site and access the Dashboard as the admin user.
- 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.
- Add the following code to the functions.php file:
add_filter( 'wc_product_sku_enabled', '__return_false' );
- The SKU will no longer be added to the product page display when disabled, as shown below:
- 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:
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:
- Log into your WordPress site and access the Dashboard as the admin user.
- 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.
- 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' );
- This code snippet will stop the SKU section from ever being added to the product template.
- This change is virtually theme independent. However, the SKU will still be displayed and edited by the WooCommerce admin, as shown below:
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.
Joe is an experienced full-stack web developer with a decade of industry experience in the LAMP & MERN stacks, WordPress, WooCommerce, and JavaScript – (diverse portfolio). He has a passion for creating elegant and user-friendly solutions and thrives in collaborative environments. In his spare time, he enjoys exploring new tech trends, tinkering with new tools, and contributing to open-source projects. You can hire me here for your next project.
Similar Articles
- How to Hide the Weight of Product in WooCommerce
- How to Hide Tags In Storefront Theme WooCommerce
- WooCommerce Storefront Show all Categories on the Homepage
- How to Hide Product Tab Title In WooCommerce
- How to Move Price WooCommerce Storefront Hooks
- How to Hide Additional Information Tab In WooCommerce
- How to Hide Product Prices Based on User Role Storefront
- How to Setup Storefront Stock Quantity & Manage Inventory
- How to Customize Storefront Checkout Page
- How to Remove, Rename and Add Storefront Sorting Options
- How to Hide Read More and Add to Cart Button WooCommerce
- How to Remove or Rename Sale Badge WooCommerce Storefront
- How to Change Storefront Theme Product Page Tabs Colors
- How to Add Submenu to Custom Post Type Menu in WordPress
- How to Hide Mobile Footer From Storefront WooCommerce
- How to Hide Quantity In Stock In WooCommerce
- How to Hide WooCommerce Registration Form
- How to Add Text Before the Price in WooCommerce » Add Text Before Price
- How to Change Storefront Theme Order of Products