Commercial aircraft can usually fly above thunderstorms safely as long as the thunderstorm or other storm is not too severe.
If the thunderstorm is too severe then the airline will usually decide to cancel the flight for the day or until the thunderstorm is gone.
If the airplane is already flying and they get close to a thunderstorm then they may if possible decide to land at another airport if the thunderstorm is bad enough.
Then they will then take off again when it's safe to do so.
Some planes have flown through storms just fine and it's been safe but some airlines may decide to ground planes when thunderstorms are forecast if they are severe enough.