To prevent onions from tasting bitter, when cooking them either by frying, sautéing or boiling, put them in hot oil and water. Avoid putting onions in oil or cold water. This is prone to making the taste of bitter onions even bitter.
Stir and Pay Attention to Cooking Time
These tips are also quite important to do. Stir the cooked garlic quickly and continuously. Garlic that is rarely stirred will make it prone to having a bitter taste because it burns easily. Also pay attention to the duration of cooking. Avoid overcooking. The longer you cook the onions, this will not only make the onions taste bitter, but also make the smell of the onions disappear.
Those are some tips that can be done to cook onions so they are not bitter. Hopefully these tips are useful and good luck trying them.