1Heat the oven to 350°F and arrange a rack in the middle. Line 2 (12-well) muffin pans with paper liners. Alternatively, coat the wells with butter; set aside.
2Combine the flour, baking powder, salt, cinnamon, and ginger in a medium bowl and whisk to aerate and break up any lumps; set aside.
3Place the butter in the bowl of a stand mixer fitted with a paddle attachment and beat on medium-high speed until very light in color, about 2 minutes. Add the sugar and vanilla and continue beating until the mixture is airy, about 2 minutes. Add the eggs one at a time and mix until well combined, about 1 minute.
4Turn off the mixer and scrape down the paddle and the sides of the bowl. Set the mixer on low speed, slowly pour in the buttermilk, and mix until combined, about 15 seconds (the batter will look curdled, but it’s fine). Add the reserved flour mixture and mix until just combined, about 15 seconds. Remove the bowl from the mixer and fold in the shredded apples and any accumulated liquid until just combined, about 1 minute.
5Fill the muffin wells about three-quarters full (about 1/4 cup per well). Place the muffin pans side by side on the rack and bake until a toothpick inserted into the center of the cupcakes comes out clean, rotating the pans front to back and side to side halfway through the baking time, about 20 to 25 minutes total. Remove the cupcakes from the pans and let cool completely on wire racks before frosting.