Preheat your oven to 180°C (350°F) and lightly grease a pie dish with butter or oil. This helps prevent the crust from sticking and ensures easy removal after baking.
In a mixing bowl, add almond flour, melted butter, erythritol, and vanilla extract. Mix everything together using a spoon or your hands until it forms a crumbly dough that holds together when pressed.
Transfer the dough into the greased pie dish and press it firmly into the bottom and up the sides. Take your time to spread it evenly so the crust bakes uniformly and holds its shape when sliced.
Place the crust in the preheated oven and bake for 10–12 minutes, or until it turns lightly golden around the edges. Once done, remove it from the oven and let it cool completely—this step is important so the filling doesn’t melt into the crust.
In a saucepan over medium heat, combine the coconut milk and heavy cream. Warm the mixture gently, stirring occasionally, until it’s hot but not boiling. You should see light steam, but avoid letting it bubble.
In a separate bowl, whisk the egg yolks and erythritol together until the mixture becomes smooth and slightly pale in color. This helps create a creamy, well-balanced filling.
Slowly pour the warm coconut mixture into the egg mixture while whisking continuously. This step, called tempering, prevents the eggs from scrambling and ensures a smooth custard texture.
Pour the combined mixture back into the saucepan and cook over medium heat. Stir constantly with a whisk or spatula, making sure to scrape the bottom, until the mixture thickens into a smooth, creamy custard.
Remove the saucepan from heat and immediately stir in the butter, vanilla extract, and shredded coconut. Mix well until everything is fully combined and the filling is rich and smooth.
Pour the warm filling into the cooled crust and spread it evenly using a spatula. Refrigerate the pie for several hours, or until fully set. Once chilled, top with whipped cream if desired, slice, and serve.