Start with a fully baked and cooled pie crust. I always make sure the crust is completely cool so the filling sets properly. A warm crust can make the custard too soft.
In a saucepan, whisk together sugar, cornstarch, and salt. Slowly add the milk and coconut milk, whisking constantly to avoid lumps. Cook over medium heat until the mixture begins to thicken.
Whisk the egg yolks in a bowl, then slowly add a small amount of the hot custard into the yolks. This step prevents scrambling and keeps the filling smooth and creamy.
Pour the tempered egg mixture back into the saucepan. Cook for a few more minutes until thick and glossy. Remove from heat and stir in butter, vanilla, and shredded coconut.
Pour the warm coconut filling into the prepared pie crust. Smooth the top with a spatula so it chills evenly. Cover with plastic wrap, touching the surface to prevent a skin.
Refrigerate the pie for at least 3 hours. This chilling time allows the custard to fully set and makes slicing clean and easy.
Whip the heavy cream with powdered sugar until soft, fluffy peaks form. I like stopping early to keep it light and airy rather than stiff.
Spread or pipe the whipped cream over the chilled pie just before serving. Garnish with extra coconut if you like, especially when serving it alongside party favorites