WordPress at Your Fingertips
function is not described

WC_Product_Variation::set_attributes() public WC 1.0

Set attributes. Unlike the parent product which uses terms, variations are assigned specific attributes using name value pairs.

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

No Hooks.

Return

null. Nothing.

Usage

$WC_Product_Variation = new WC_Product_Variation();
$WC_Product_Variation->set_attributes( $raw_attributes );
$raw_attributes(array) (required)
array of raw attributes.

Code of WC_Product_Variation::set_attributes() WC 5.6.0

public function set_attributes( $raw_attributes ) {
	$raw_attributes = (array) $raw_attributes;
	$attributes     = array();

	foreach ( $raw_attributes as $key => $value ) {
		// Remove attribute prefix which meta gets stored with.
		if ( 0 === strpos( $key, 'attribute_' ) ) {
			$key = substr( $key, 10 );
		}
		$attributes[ $key ] = $value;
	}
	$this->set_prop( 'attributes', $attributes );
}