AfterShip – WooCommerce Tracking - Version 1.12.9

Version Description

  • Compatible for get order data
Download this release

Release Info

Developer aftership
Plugin Icon 128x128 AfterShip – WooCommerce Tracking
Version 1.12.9
Comparing to
See all releases

Code changes from version 1.12.8 to 1.12.9

aftership-woocommerce-tracking.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: AfterShip - WooCommerce Shipment Tracking (Order Tracking Made Easy)
4
  Plugin URI: http://aftership.com/
5
  Description: All-in-one Woocommerce shipment tracking, branded order tracking pages, Email & SMS notifications. FedEx,USPS,UPS,DHL,Canada Post 800+ couriers.
6
- Version: 1.12.8
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
20
 
21
  require_once( 'woo-includes/woo-functions.php' );
22
 
23
- define( 'AFTERSHIP_VERSION', '1.12.8' );
24
 
25
  if ( is_woocommerce_active() ) {
26
 
3
  Plugin Name: AfterShip - WooCommerce Shipment Tracking (Order Tracking Made Easy)
4
  Plugin URI: http://aftership.com/
5
  Description: All-in-one Woocommerce shipment tracking, branded order tracking pages, Email & SMS notifications. FedEx,USPS,UPS,DHL,Canada Post 800+ couriers.
6
+ Version: 1.12.9
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
20
 
21
  require_once( 'woo-includes/woo-functions.php' );
22
 
23
+ define( 'AFTERSHIP_VERSION', '1.12.9' );
24
 
25
  if ( is_woocommerce_active() ) {
26
 
includes/api/v5/class-rest-orders-helper.php CHANGED
@@ -137,47 +137,11 @@ class Rest_Orders_Helper {
137
  * @return array
138
  */
139
  public function get_formatted_item_data( $order ) {
140
- $extra_fields = array( 'meta_data', 'line_items', 'tax_lines', 'shipping_lines', 'fee_lines', 'coupon_lines', 'refunds' );
141
  $format_decimal = array( 'discount_total', 'discount_tax', 'shipping_total', 'shipping_tax', 'shipping_total', 'shipping_tax', 'cart_tax', 'total', 'total_tax' );
142
  $format_date = array( 'date_created', 'date_modified', 'date_completed', 'date_paid' );
143
  $format_line_items = array( 'line_items', 'tax_lines', 'shipping_lines', 'fee_lines', 'coupon_lines' );
144
 
145
- $data = $order->get_base_data();
146
-
147
- // Add extra data as necessary.
148
- foreach ( $extra_fields as $field ) {
149
- switch ( $field ) {
150
- case 'meta_data':
151
- $data['meta_data'] = $order->get_meta_data();
152
- break;
153
- case 'line_items':
154
- $data['line_items'] = $order->get_items( 'line_item' );
155
- break;
156
- case 'tax_lines':
157
- $data['tax_lines'] = $order->get_items( 'tax' );
158
- break;
159
- case 'shipping_lines':
160
- $data['shipping_lines'] = $order->get_items( 'shipping' );
161
- break;
162
- case 'fee_lines':
163
- $data['fee_lines'] = $order->get_items( 'fee' );
164
- break;
165
- case 'coupon_lines':
166
- $data['coupon_lines'] = $order->get_items( 'coupon' );
167
- break;
168
- case 'refunds':
169
- $data['refunds'] = array();
170
- foreach ( $order->get_refunds() as $refund ) {
171
- $data['refunds'][] = array(
172
- 'id' => $refund->get_id(),
173
- 'reason' => $refund->get_reason() ? $refund->get_reason() : '',
174
- 'total' => '-' . wc_format_decimal( $refund->get_amount(), $this->dp ),
175
- );
176
- }
177
- break;
178
- }
179
- }
180
-
181
  // Format decimal values.
182
  foreach ( $format_decimal as $key ) {
183
  $data[ $key ] = wc_format_decimal( $data[ $key ], $this->dp );
@@ -198,6 +162,16 @@ class Rest_Orders_Helper {
198
  $data[ $key ] = array_values( array_map( array( $this, 'get_order_item_data' ), $data[ $key ] ) );
199
  }
200
 
 
 
 
 
 
 
 
 
 
 
201
  $allowed_fields = array(
202
  'id',
203
  'parent_id',
137
  * @return array
138
  */
139
  public function get_formatted_item_data( $order ) {
140
+ $data = $order->get_data();
141
  $format_decimal = array( 'discount_total', 'discount_tax', 'shipping_total', 'shipping_tax', 'shipping_total', 'shipping_tax', 'cart_tax', 'total', 'total_tax' );
142
  $format_date = array( 'date_created', 'date_modified', 'date_completed', 'date_paid' );
143
  $format_line_items = array( 'line_items', 'tax_lines', 'shipping_lines', 'fee_lines', 'coupon_lines' );
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  // Format decimal values.
146
  foreach ( $format_decimal as $key ) {
147
  $data[ $key ] = wc_format_decimal( $data[ $key ], $this->dp );
162
  $data[ $key ] = array_values( array_map( array( $this, 'get_order_item_data' ), $data[ $key ] ) );
163
  }
164
 
165
+ // Refunds.
166
+ $data['refunds'] = array();
167
+ foreach ( $order->get_refunds() as $refund ) {
168
+ $data['refunds'][] = array(
169
+ 'id' => $refund->get_id(),
170
+ 'reason' => $refund->get_reason() ? $refund->get_reason() : '',
171
+ 'total' => '-' . wc_format_decimal( $refund->get_amount(), $this->dp ),
172
+ );
173
+ }
174
+
175
  $allowed_fields = array(
176
  'id',
177
  'parent_id',
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.aftership.com/
4
  Tags: woocommerce shipping,woocommerce tracking,shipment tracking,order tracking,woocommerce,dhl,ups,usps,fedex,shipping,tracking,order status,carrier,courier,delivery
5
  Requires at least: 2.9
6
  Tested up to: 5.7
7
- Stable tag: 1.12.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -129,6 +129,9 @@ Tailor a dynamic branded tracking page. Upload promotional banner, logo, and fav
129
 
130
  == Changelog ==
131
 
 
 
 
132
  = 1.12.8 =
133
  * Update readme
134
 
4
  Tags: woocommerce shipping,woocommerce tracking,shipment tracking,order tracking,woocommerce,dhl,ups,usps,fedex,shipping,tracking,order status,carrier,courier,delivery
5
  Requires at least: 2.9
6
  Tested up to: 5.7
7
+ Stable tag: 1.12.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
129
 
130
  == Changelog ==
131
 
132
+ = 1.12.9 =
133
+ * Compatible for get order data
134
+
135
  = 1.12.8 =
136
  * Update readme
137