herpa derpa

This commit is contained in:
Mike Jolley 2017-08-10 15:57:34 +01:00
parent e90fb6d54f
commit 22d6c789ab
2 changed files with 3 additions and 5 deletions

View File

@ -190,7 +190,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
// Add/save items.
foreach ( $this->items as $item_group => $items ) {
if ( is_array( $items ) ) {
foreach ( array_filter( $items ) as $item_key => $item ) {
$items = array_filter( $items );
foreach ( $items as $item_key => $item ) {
$item->set_order_id( $this->get_id() );
$item_id = $item->save();
@ -952,8 +953,6 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
}
}
error_log( print_r( $coupon_discounts, true ));
// Add WC_Order_Item_Coupon objects for applied coupons.
if ( $coupon_discounts ) {
foreach ( $coupon_discounts as $coupon_code => $amount ) {
@ -1282,8 +1281,6 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$item->save();
}
$this->items = array(); // clear so saved values are reloaded.
$this->update_taxes();
}

View File

@ -355,6 +355,7 @@ class WC_Order extends WC_Abstract_Order {
'shipping_lines' => $this->get_items( 'shipping' ),
'fee_lines' => $this->get_items( 'fee' ),
'coupon_lines' => $this->get_items( 'coupon' ),
'discount_lines' => $this->get_items( 'discount' ),
)
);
}