So, I'm successfully adding products, variations with attributes, etc in a plugin I'm writing. The problem I'm having is that on the frontend the attributes appear as the raw name (e.g. pa_variation_name) rather than a clean looking title (e.g. Variation Name).
I am adding the attribute to the parent product as follows...
$product = wc_get_product($post_id);
$attribute = new WC_Product_Attribute();
$attribute->set_name('pa_variation_name');
$attribute->set_options($attributes_array);
$attribute->set_visible(true);
$attribute->set_variation(true);
$attributes[] = $attribute;
$product->set_attributes($attributes);
$product->save();
And adding the data to the individual variations like this:
update_post_meta($variation_id, 'attribute_pa_variation_name', $args['Description']);
Maybe I'm missing something obvious but how can I set a clean title so I don't have 'pa_whatever' appearing on the frontend?