| @@ 56-58 (lines=3) @@ | ||
| 53 | ||
| 54 | // Handly qty if set |
|
| 55 | if ( isset( $args['qty'] ) ) { |
|
| 56 | if ( $product->backorders_require_notification() && $product->is_on_backorder( $args['qty'] ) ) { |
|
| 57 | $item->add_meta_data( apply_filters( 'woocommerce_backordered_item_meta_name', __( 'Backordered', 'woocommerce' ) ), $args['qty'] - max( 0, $product->get_total_stock() ), true ); |
|
| 58 | } |
|
| 59 | $args['subtotal'] = $args['subtotal'] ? $args['subtotal'] : $product->get_price_excluding_tax( $args['qty'] ); |
|
| 60 | $args['total'] = $args['total'] ? $args['total'] : $product->get_price_excluding_tax( $args['qty'] ); |
|
| 61 | } |
|
| @@ 1043-1045 (lines=3) @@ | ||
| 1040 | $item = new WC_Order_Item_Product( $args ); |
|
| 1041 | ||
| 1042 | // Handle backorders |
|
| 1043 | if ( $product->backorders_require_notification() && $product->is_on_backorder( $args['qty'] ) ) { |
|
| 1044 | $item->add_meta_data( apply_filters( 'woocommerce_backordered_item_meta_name', __( 'Backordered', 'woocommerce' ) ), $args['qty'] - max( 0, $product->get_total_stock() ), true ); |
|
| 1045 | } |
|
| 1046 | ||
| 1047 | $item->set_order_id( $this->get_id() ? $this->get_id() : $this->save() ); |
|
| 1048 | $item->save(); |
|
| @@ 248-250 (lines=3) @@ | ||
| 245 | ) ); |
|
| 246 | ||
| 247 | // Handle backorders @todo improve how these are handled/stored |
|
| 248 | if ( $product->backorders_require_notification() && $product->is_on_backorder( $args['qty'] ) ) { |
|
| 249 | $item->add_meta_data( apply_filters( 'woocommerce_backordered_item_meta_name', __( 'Backordered', 'woocommerce' ) ), $values['quantity'] - max( 0, $product->get_total_stock() ), true ); |
|
| 250 | } |
|
| 251 | ||
| 252 | // Set this to pass to legacy actions @todo remove in future release |
|
| 253 | $item->legacy_values = $values; |
|