WordPress at a glance
function is not described

WC_REST_Products_V1_Controller::get_default_attributes() protected WC 1.0

Get default attributes.

{} It's a method of the class: WC_REST_Products_V1_Controller{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_default_attributes( $product );
$product(WC_Product) (required)
Product instance.

Code of WC_REST_Products_V1_Controller::get_default_attributes() WC 5.0.0

<?php
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'   => wc_attribute_taxonomy_slug( $key ),
					'option' => $value,
				);
			}
		}
	}

	return $default;
}