From 91f1f63100a2a01a984a9a93af634a461e56bbd5 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 1 Sep 2017 11:02:11 +0100 Subject: [PATCH] Code standards --- .../api/class-wc-rest-order-refunds-controller.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/includes/api/class-wc-rest-order-refunds-controller.php b/includes/api/class-wc-rest-order-refunds-controller.php index 8f23f2fa7eb..1f0b613bf77 100644 --- a/includes/api/class-wc-rest-order-refunds-controller.php +++ b/includes/api/class-wc-rest-order-refunds-controller.php @@ -284,13 +284,6 @@ class WC_REST_Order_Refunds_Controller extends WC_REST_Orders_Controller { 'restock_items' => true, ) ); - if(!empty( $request['meta_data'] ) && is_array( $request['meta_data'] )) { - foreach ( $request['meta_data'] as $meta ) { - $refund->update_meta_data( $meta['key'], $meta['value'], isset( $meta['id'] ) ? $meta['id'] : '' ); - } - $refund->save_meta_data(); - } - if ( is_wp_error( $refund ) ) { return new WP_Error( 'woocommerce_rest_cannot_create_order_refund', $refund->get_error_message(), 500 ); } @@ -299,6 +292,13 @@ class WC_REST_Order_Refunds_Controller extends WC_REST_Orders_Controller { return new WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce' ), 500 ); } + if ( ! empty( $request['meta_data'] ) && is_array( $request['meta_data'] ) ) { + foreach ( $request['meta_data'] as $meta ) { + $refund->update_meta_data( $meta['key'], $meta['value'], isset( $meta['id'] ) ? $meta['id'] : '' ); + } + $refund->save_meta_data(); + } + /** * Filters an object before it is inserted via the REST API. *