product_amount; if ($productAmount <= 0 && (float) $order->total_amount > 0) { $productAmount = round((float) $order->total_amount - (float) $order->added_amount, 2); } $order->box_num = $boxNum; $order->tray_num = $trayNum; $order->product_amount = $productAmount; $order->added_amount = $addedAmount; $order->total_amount = round($productAmount + $addedAmount, 2); $order->save(); } }