Phantom Hourglass and Spirit Tracks
The main purpose of the Purple Potion in these games is that when Link drinks it, he regains eight hearts. However, in these games, Purple Potion acts as the Fairy of the game. When Link dies, he automatically drinks the potion to regain eight hearts.
In Phantom Hourglass, Link can find Purple Potion at the Mercay Island shop and the Molida Island shop for 150 Rupees. In Spirit Tracks, Link can find Purple Potion at Beedle's Air Shop for the same price.
A Link Between Worlds
The Purple Potion can be bought at the Witch's House after obtaining a Bottle and 10 Monster Guts. The Potion costs 60 rupees and will allow Link to perform a special spin attack that damages all surrounding enemies.