[2.4] Fixed WC_API_Orders::set_line_item() for v2 #9338

This commit is contained in:
Claudio Sanches 2015-10-11 11:34:34 -03:00
parent 5465cdadb1
commit 5c6206e511
1 changed files with 2 additions and 3 deletions

View File

@ -866,7 +866,8 @@ class WC_API_Orders extends WC_API_Resource {
*/
protected function set_line_item( $order, $item, $action ) {
$creating = ( 'create' === $action );
$creating = ( 'create' === $action );
$item_args = array();
// product is always required
if ( ! isset( $item['product_id'] ) && ! isset( $item['sku'] ) ) {
@ -919,8 +920,6 @@ class WC_API_Orders extends WC_API_Resource {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity is required', 'woocommerce' ), 400 );
}
$item_args = array();
// quantity
if ( isset( $item['quantity'] ) ) {
$item_args['qty'] = $item['quantity'];