WC_Order_Item_Product::set_variation()publicWC 1.0

Set variation data (stored as meta data - write only).

Method of the class: WC_Order_Item_Product{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Order_Item_Product = new WC_Order_Item_Product();
$WC_Order_Item_Product->set_variation( $data );
$data(array)
Key/Value pairs.
Default: array()

WC_Order_Item_Product::set_variation() code WC 9.4.2

public function set_variation( $data = array() ) {
	if ( is_array( $data ) ) {
		foreach ( $data as $key => $value ) {
			$this->add_meta_data( str_replace( 'attribute_', '', $key ), $value, true );
		}
	}
}