How To Disable Unique SKU’s In WooCommerce

WooCommerce is an robust and easily customizable eCommerce solution. WooCommerce is built on top of WordPress. This allows for loads of customization.
The other advantage is that it allows you to make changes to how it functions, without needing to edit it’s core files.

On the flip side, there are many things in WooCommerce that are not so good. Notably, its performance issues. That being said, an interesting thing that is asked every now and again is when it comes to inventory management, how can you use the same SKU for multiple products in WooCommerce?

It is an interesting use case. For example, some users simply add multiple variations of a product as individual products. I do not understand this setup. I believe they enjoy the extra flexibility, of being able to add different variations as individual products.

There is good news. You can disable unique SKU’s in WordPress with a single line of PHP. This works because WooCommerce makes really good use of filters. You can add the below code below to your functions.php file or a site specific plugin.

add_filter( 'wc_product_has_unique_sku', '__return_false', PHP_INT_MAX );

Congratulations you have now disabled unique SKU’s in WooCommerce. It’s an incredibly simple fix for a very interesting problem.

If you have any questions regarding this code or a general question regarding WooCommerce feel free to comment below!

scott hartley

About the author

Scott is a web performance geek, lover of all things coffee, and avid video game player. His WordPress work delves into web performance, web security, and SEO.

Leave a Comment