Yes, of course!
Most people with heart conditions can travel by airplane safely with no issue. Most airlines do not ask about health status when booking a ticket. Therefore, you can travel even if you have a history of a heart condition.
However, if you have a history of heart problems (recent heart attack, arrhythmia, heart surgery, and other heart-related problems), it is important for you to check with your doctor that you are fit to travel on an airplane.
Inform your doctor about your plan to travel, and appropriate measures will be taken to ensure you are medically fit to travel.