Code Duplication    Length = 16-16 lines in 2 locations

includes/cli/class-wc-cli-order.php 1 location

@@ 989-1004 (lines=16) @@
986
			$item_args['totals']['subtotal_tax'] = floatval( $item['subtotal_tax'] );
987
		}
988
989
		if ( $creating ) {
990
991
			$item_id = $order->add_product( $product, $item_args['qty'], $item_args );
992
993
			if ( ! $item_id ) {
994
				throw new WC_CLI_Exception( 'woocommerce_cannot_create_line_item', __( 'Cannot create line item, try again', 'woocommerce' ) );
995
			}
996
997
		} else {
998
999
			$item_id = $order->update_product( $item['id'], $product, $item_args );
1000
1001
			if ( ! $item_id ) {
1002
				throw new WC_CLI_Exception( 'woocommerce_cannot_update_line_item', __( 'Cannot update line item, try again', 'woocommerce' ) );
1003
			}
1004
		}
1005
	}
1006
1007
	/**

includes/api/class-wc-api-orders.php 1 location

@@ 982-997 (lines=16) @@
979
			$item_args['totals']['subtotal_tax'] = floatval( $item['subtotal_tax'] );
980
		}
981
982
		if ( $creating ) {
983
984
			$item_id = $order->add_product( $product, $item_args['qty'], $item_args );
985
986
			if ( ! $item_id ) {
987
				throw new WC_API_Exception( 'woocommerce_cannot_create_line_item', __( 'Cannot create line item, try again', 'woocommerce' ), 500 );
988
			}
989
990
		} else {
991
992
			$item_id = $order->update_product( $item['id'], $product, $item_args );
993
994
			if ( ! $item_id ) {
995
				throw new WC_API_Exception( 'woocommerce_cannot_update_line_item', __( 'Cannot update line item, try again', 'woocommerce' ), 500 );
996
			}
997
		}
998
	}
999
1000
	/**