Programmatically adding line items to Ubercart order
The issue was I was assigning the value in order total manually from the product details, instead of using ubercart's $order->getTotal() , which defines line item initially. Hence, this worked for me to get the order generated after setting product and other payment details in order:

$order-&gt;total               = $order-&gt;getTotal();
$order-&gt;line_items          = $order-&gt;getLineItems();
$order-&gt;save();