Creating WooCommerce product variation adds an empty attribute value
问题 When adding variations to a WooCommerce product it is adding in a blank attribute. Meaning that when I try to add in my own attribute it gets appended to an existing array. Example code I am running: $product_variation = wc_get_product( $variation_id ); $product_variation->set_attributes(array('attribute_pa_varinfo' => 'blue')); $product_variation->save(); Then when I var_dump($product_variation); I get the following: ["attributes"]=> array(2) { [0]=> string(0) "" ["pa_varinfo"]=> string(4)