WordPress at Your Fingertips
function is not described

WC_Product::set_default_attributes() public WC 3.0.0

Set default attributes. These will be saved as strings and should map to attribute values.

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

No Hooks.


null. Nothing.


$WC_Product = new WC_Product();
$WC_Product->set_default_attributes( $default_attributes );
$default_attributes(array) (required)
List of default attributes.


Since 3.0.0 Introduced.

Code of WC_Product::set_default_attributes() WC 5.5.2

public function set_default_attributes( $default_attributes ) {
	$this->set_prop( 'default_attributes', array_map( 'strval', array_filter( (array) $default_attributes, 'wc_array_filter_default_attributes' ) ) );