Preheat the oven to 350°F (180°C) and adjust an oven rack to the center position. Line 2 cupcake pans with cupcake liners. Lightly spray the top of the pans with a nonstick cooking spray with flour, such as Baker’s Joy or Pam Baking Spray with Flour, just in case the cupcake tops stick to the pan (don’t worry if the spray gets in the liners).
Pour the coconut milk into a medium bowl. (If, when you opened your can of coconut milk, the coconut milk had separated from the coconut cream floating at the top of the can, then you’ll want to recombine them with a whisk or immersion blender.) Add the lemon juice.
In a medium bowl, whisk together the flour, cornstarch, salt, and baking soda.
In the bowl of an electric mixer fitted with the paddle attachment or beaters, beat the butter and granulated sugar on medium speed until light and fluffy, 3 to 6 minutes. Beat in the vanilla and then beat in the eggs, 1 at a time, scraping down the sides of the bowl as necessary.
Turn the speed down to low and beat in 1/3 of the flour mixture, followed by 1/2 of the coconut milk-lemon juice mixture. Scrape down the sides of the bowl. Add another 1/3 of the flour mixture, followed by the remaining coconut milk–lemon juice mixture. Beat in the remaining flour mixture and then scrape down the bowl and beat again until the batter is just combined. Quickly mix in the shredded coconut; do not overmix.
Spoon the batter into the prepared cupcake pans, filling each cup about 3/4 full. Bake for 20 to 23 minutes, until the cupcakes are set, lightly golden, and a toothpick or cake tester inserted into the center of a cupcake comes out clean (note that one pan may finish baking before the other). Let cool in the pans for about 10 minutes, then transfer to a wire rack to cool completely.