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.

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:

how to use same sku in two products 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

Proudly powered by Statamic, hosted @ Hostinger, private analytics by Fathom

2024 © Rock Solid Website