Yes, you can cook a recipe without onions if you don’t have or you choose not to have them in there, although you will miss out on some of the complex flavorings that they bring to a dish. Onions add both texture and flavor to a recipe and are often one of the most common base ingredients in saucy dishes like spaghetti bolognese. When raw onions are put into a recipe or used to top, they can add a spicy flavor but when they’re cooked they soften and go sweet and can even caramelize to the point where they are undetectable by taste.