如何在 WooCommerce 中创建多个具有相同 SKU 的简单产品?

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

我想在 WooCommerce 中创建多个具有相同 SKU 的简单产品。 我在管理设置中搜索,但找不到任何设置来启用此功能。有没有什么钩子可以让我禁用这个功能。

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' ); 

代码进入您的活动子主题(或主题)的 function.php 文件。或者在任何插件 php 文件中。
希望这对您有所帮助!