I'd like to set the SKU to the ID of the product.. but cannot find the right filter to use?
Is there a filter that sends the product SKU?
add_filter( 'woocommerce_get_sku', 'update_sku', 10, 1);
function update_sku( $sku ){
//set $newsku as product id
return $newsku;
}
How do i accomplish this? I have 1000s of products without a SKU. I've tried a plugin called SKU generator but that doesn't work. Any help appreciated.
You can do it by adding following code to your
functions.php
file and after adding go to you siteexample.com
for only once.After that remove below code from the
functions.php
.NOTE : If you don't remove after one use, products SKU will change everytime you visit any page of your site.