/**
* Get default attributes.
*
* @param WC_Product $product Product instance.
* @return array
*/
protected function get_default_attributes($product)
{
$default = array();
if ($product->is_type('variable')) {
foreach (array_filter((array) $product->get_default_attributes(), 'strlen') as $key => $value) {
if (0 === strpos($key, 'pa_')) {
$default[] = array('id' => wc_attribute_taxonomy_id_by_name($key), 'name' => $this->get_attribute_taxonomy_label($key), 'option' => $value);
} else {
$default[] = array('id' => 0, 'name' => str_replace('pa_', '', $key), 'option' => $value);
}
}
}
return $default;
}