Removed deprecated WC_Order_Item_Meta from REST API v1

This commit is contained in:
Claudio Sanches 2017-04-24 20:55:09 -03:00
parent 4ded36c66d
commit 2d9e876e6d
2 changed files with 8 additions and 12 deletions

View File

@ -156,17 +156,15 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller {
$product_sku = $product->get_sku();
}
$meta = new WC_Order_Item_Meta( $item, $product );
$item_meta = array();
$hideprefix = 'true' === $request['all_item_meta'] ? null : '_';
foreach ( $meta->get_formatted( $hideprefix ) as $meta_key => $formatted_meta ) {
foreach ( $item->get_formatted_meta_data( $hideprefix, true ) as $meta_key => $formatted_meta ) {
$item_meta[] = array(
'key' => $formatted_meta['key'],
'label' => $formatted_meta['label'],
'value' => $formatted_meta['value'],
'key' => $formatted_meta->key,
'label' => $formatted_meta->display_key,
'value' => wc_clean( $formatted_meta->display_value ),
);
}

View File

@ -187,17 +187,15 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller {
$product_sku = $product->get_sku();
}
$meta = new WC_Order_Item_Meta( $item, $product );
$item_meta = array();
$hideprefix = 'true' === $request['all_item_meta'] ? null : '_';
foreach ( $meta->get_formatted( $hideprefix ) as $meta_key => $formatted_meta ) {
foreach ( $item->get_formatted_meta_data( $hideprefix, true ) as $meta_key => $formatted_meta ) {
$item_meta[] = array(
'key' => $formatted_meta['key'],
'label' => $formatted_meta['label'],
'value' => $formatted_meta['value'],
'key' => $formatted_meta->key,
'label' => $formatted_meta->display_key,
'value' => wc_clean( $formatted_meta->display_value ),
);
}