Fix fee/coupon lines typo in REST API order response
This commit is contained in:
parent
97e0449bd8
commit
27b302b075
|
@ -214,7 +214,7 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
// add fees
|
// add fees
|
||||||
foreach ( $order->get_fees() as $fee_item_id => $fee_item ) {
|
foreach ( $order->get_fees() as $fee_item_id => $fee_item ) {
|
||||||
|
|
||||||
$order_data['fee_lines'] = array(
|
$order_data['fee_lines'][] = array(
|
||||||
'id' => $fee_item_id,
|
'id' => $fee_item_id,
|
||||||
'title' => $fee_item['name'],
|
'title' => $fee_item['name'],
|
||||||
'tax_class' => ( ! empty( $fee_item['tax_class'] ) ) ? $fee_item['tax_class'] : null,
|
'tax_class' => ( ! empty( $fee_item['tax_class'] ) ) ? $fee_item['tax_class'] : null,
|
||||||
|
@ -226,7 +226,7 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
// add coupons
|
// add coupons
|
||||||
foreach ( $order->get_items( 'coupon' ) as $coupon_item_id => $coupon_item ) {
|
foreach ( $order->get_items( 'coupon' ) as $coupon_item_id => $coupon_item ) {
|
||||||
|
|
||||||
$order_data['coupon_lines'] = array(
|
$order_data['coupon_lines'][] = array(
|
||||||
'id' => $coupon_item_id,
|
'id' => $coupon_item_id,
|
||||||
'code' => $coupon_item['name'],
|
'code' => $coupon_item['name'],
|
||||||
'amount' => wc_format_decimal( $coupon_item['discount_amount'], 2 ),
|
'amount' => wc_format_decimal( $coupon_item['discount_amount'], 2 ),
|
||||||
|
|
Loading…
Reference in New Issue