Home » WooCommerce » How to use one SKU for multiple products in WooCommerce

How to use one SKU for multiple products in WooCommerce

Want to use a single SKU for more than one product in WooCommerce? By default WooCommerce does not allow this. If you’ll still try to do it you’ll get error message “Invalid or duplicated SKU” and the SKU won’t be saved to more than one product.

But it’s not that bad actually – you can overcome this limitation quite easily by adding a small line of code to your website. Here’s how you do it in less than 3 minutes.

How to allow duplicate SKU for multiple WooCommerce products

In order to allow duplicate SKU in WooCommerce you’ll need to add a line of code to your WordPress theme’s functions.php file.

Go to Apperance >> Theme File Editor (or Tools >> Theme File Editor) in WordPress admin panel, and open functions.php file on the right side of the screen.

Best WordPress hosting 2024

Once you’re there scroll to the bottom of the function.php file and add this line of code:

add_filter( 'wc_product_has_unique_sku', '__return_false' ); 

It should look something like that:

woocommerce disable unique sku
Disable unique SKU in WooCommerce

Once you hit Update File button to save changes, your WooCommerce store will allow using the same SKU for more than one product.

Looking for more WooCommerce tutorials? Click here

Tags:

Fathom analytics - privacy focused cookie-free website analytics

Most popular tutorials


Get our latest WordPress news and special offers from RockSolidWP!

Only useful WordPress and WooCommerce tips and tricks and exclusive offers for our readers once a month. No marketing nonsense.

Looking for reliable yet affordable WordPress hosting?
Hostinger is the way to go!

Get 10% OFF by using code IMAKEITWORK