Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create multiple simple-products with same SKU in WooCommerce?

I want to create multiple simple-product with same SKU in WooCommerce. I search in admin settings but there I cannot find any settings to enable this features. Is there any hook so I can disable this features.

like image 427
dineshkashera Avatar asked Jan 11 '17 06:01

dineshkashera


1 Answers

If you want to completely disable the SKU feature then you have to use wc_product_sku_enabled filter. It will remove the SKU field from both backend and frontend.

add_filter( 'wc_product_sku_enabled', '__return_false' );

If you want to keep the SKU feature but need to disable unique SKU check then you have to use wc_product_has_unique_sku filter. It will keep the SKU field in both backend and frontend, but will allow you to add multiple duplicate SKU.

add_filter( 'wc_product_has_unique_sku', '__return_false' ); 

Code goes in function.php file of your active child theme (or theme). Or also in any plugin php files.
Hope this helps!

like image 160
Raunak Gupta Avatar answered Sep 21 '22 10:09

Raunak Gupta