From 00b9887936a5fa40da08f5ad639f8efe06244e40 Mon Sep 17 00:00:00 2001 From: Manos Psychogyiopoulos Date: Mon, 21 Mar 2016 14:39:51 +0200 Subject: [PATCH] add order line item args filter to wc api/cli set_line_item method --- includes/api/class-wc-api-orders.php | 2 ++ includes/cli/class-wc-cli-order.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/includes/api/class-wc-api-orders.php b/includes/api/class-wc-api-orders.php index 48d15e8c448..6af15806327 100644 --- a/includes/api/class-wc-api-orders.php +++ b/includes/api/class-wc-api-orders.php @@ -979,6 +979,8 @@ class WC_API_Orders extends WC_API_Resource { $item_args['totals']['subtotal_tax'] = floatval( $item['subtotal_tax'] ); } + $item_args = apply_filters( 'woocommerce_api_order_line_item_args', $item_args, $item, $order, $action ); + if ( $creating ) { $item_id = $order->add_product( $product, $item_args['qty'], $item_args ); diff --git a/includes/cli/class-wc-cli-order.php b/includes/cli/class-wc-cli-order.php index 3a3e0a73453..2c82a141a3f 100644 --- a/includes/cli/class-wc-cli-order.php +++ b/includes/cli/class-wc-cli-order.php @@ -986,6 +986,8 @@ class WC_CLI_Order extends WC_CLI_Command { $item_args['totals']['subtotal_tax'] = floatval( $item['subtotal_tax'] ); } + $item_args = apply_filters( 'woocommerce_cli_order_line_item_args', $item_args, $item, $order, $action ); + if ( $creating ) { $item_id = $order->add_product( $product, $item_args['qty'], $item_args );