My suggestion would be to add in a simple flag that checks whether this is the initial time we’ve set our defaults, something such as below:
function initial_product_data ( $post_id ) {
// lets get out of here if this is not a new product
if ( 'product' != $_POST['post_type'] )
return;
//Grab our initial meta value, if set will return true else wordpress will return and empty string(falsey)
$initial = get_post_meta($post_id, 'initial', true);
if(!$initial){
// make sure the post isn't automagically featured
// WTF WooCommerce??!!
update_post_meta( $post_id, '_featured', 'no' );
// automatically set the swatch
update_post_meta( $post_id, '_swatch_type', 'pickers' );
update_post_meta( $post_id, '_swatch_type_options', unserialize('a:1:{s:7:"pa_size";a:4:{s:4:"type";s:12:"term_options";s:6:"layout";s:7:"default";s:4:"size";s:19:"swatches_image_size";s:10:"attributes";a:3:{s:7:"x-large";a:3:{s:4:"type";s:5:"color";s:5:"color";s:7:"#FFFFFF";s:5:"image";s:1:"0";}s:23:"x-large-toplarge-bottom";a:3:{s:4:"type";s:5:"color";s:5:"color";s:7:"#FFFFFF";s:5:"image";s:1:"0";}s:23:"x-small-topsmall-bottom";a:3:{s:4:"type";s:5:"color";s:5:"color";s:7:"#FFFFFF";s:5:"image";s:1:"0";}}}}') );
//Set our initial check value to true, to prevent the above code running again
update_post_meta($post_id, 'initial', true);
}
}
add_action( 'wp_insert_post', 'initial_product_data' );
That should do the trick and only set the default upon the initial creation of the product.