WC_Order_Item_Product::set_variation()
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() 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 ); } } }