It's not hugely profitable, its simply a draw for foot traffic to sell more snacks, alcohol, and food. 7-11 and Wawa have been serving gas since as long as I can remember.
Gas stations make about 10 cents per gallon gross profit on the gas pumped. That's before capital equipment depreciation, equipment maintenance, facilities staff, cleaning, etc.
It's profitable, but it produces a minority of the business's profit. The bulk of the profit is from higher margin snacks, drinks, alcohol, cigarettes, lottery, etc.
A switch from gas to electric is not going to affect most convenience stores.