[2.4] Fixed WC_API_Orders::set_line_item() for v2 #9338
This commit is contained in:
parent
5465cdadb1
commit
5c6206e511
|
@ -867,6 +867,7 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
protected function set_line_item( $order, $item, $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'];
|
||||
|
|
Loading…
Reference in New Issue