Hello friend!
I put your code and it broke the site lol, it was hard to reactivate, I had to put the snippet plugin in safe mode to activate it and remove the code, it was wrong, here is the fix:
add_action(‘woocommerce_product_duplicate_before_save’, function($new_product, $old_product) {
$new_product->set_sku(”);
}, 999, 2);
The code only solved the problem by clearing the duplicate main SKU and generating a new one.
But the variations still need to save the product TWICE to generate the variation SKU based on the parent SKU.
I tried to get help from Chatgpt, I created several codes, but nothing worked.
Would you be able to see this improvement?