Question: how to transfer messages from whatsapp to new iphone?
Answer: Make sure you have an iCloud backup function for iPhone enabled on both your phones.
On your old iPhone, go to WhatsApp.
Tap settings > Chat settings > Chat backup.
Click on Backup Now. ... 
Now on your new iPhone, install WhatsApp.