Check data is an array in set_variation method

Closes #16232
This commit is contained in:
Mike Jolley 2017-07-24 10:43:34 +01:00
parent c5055ed2f7
commit 504a216582
1 changed files with 5 additions and 3 deletions

View File

@ -165,11 +165,13 @@ class WC_Order_Item_Product extends WC_Order_Item {
*
* @param array $data Key/Value pairs
*/
public function set_variation( $data ) {
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 );
}
}
}
/**
* Set properties based on passed in product object.