How to get free Solar Fusion Energy and Lunar Fusion Energy with codes in Pokémon Go
There are multiple ways to get Solar Fusion Energy and Lunar Fusion Energy in Pokémon Go, including with free Energy codes leading up to the event.
This article references relevant content from the polygon.com website. Original article link: [https://www.polygon.com/pokemon-go-guide/24195548/solar-fusion-energy-lunar-fusion-how-to-get]

Solar Fusion Energy and Lunar Fusion Energy are a key part of acquiring Necrozma’s Dusk Mane and Dawn Wings forms in Pokémon Go.
As well as having the required Pokémon (Necrozma and either Solgalego or Lunala), you also need the correct Energy specific to the Necrozma form you are trying to create through Fusion.
The main opportunity to get Solar Fusion Energy and Lunar Fusion Energy will take place during Go Fest Global 2024, both in raids and through ticketed research, however there is a way to get extra free Fusion Energy through promotional codes.
Free Solar Fusion Energy and Lunar Fusion Energy codes

As part of an Instagram promotion, developer Niantic is giving away codes that grant free Solar Fusion Energy and Lunar Fusion Energy on alternating days.
The codes, and the URL to redeem them on the official Pokémon Go code redemption site, are as follows:
As of Sunday of the Go Fest weekend, all codes are active. Whether they will be after the weekend is unknown — so to be safe, redeem each code as soon as possible.
How to get Solar Fusion Energy and Lunar Fusion Energy in Pokémon Go

As of July 2024 (when Go Fest Global takes place), there are three ways for all players to get Solar Fusion Energy and Lunar Fusion Energy:
Additionally, for those who attended Go Fest Madrid, Sendai, or New York City, you should already have 1,000 Solar Fusion or Lunar Fusion Energy from completing event-exclusive research, depending on which branching path you took.
Looking for more to do during Go Fest 2024? You can follow the habitat schedule, battle raids effectively with strong Necrozma counters, and complete Marshadow research “A Shadowy Caper”.