In an ideal world, your kitchen cupboards or pantry would always hold every ingredient you need, every time you want to bake. Reality is usually less obliging, so making emergency substitutions is a regular occurrence for most bakers. Even boxed cake mixes sometimes require a bit of creativity. For example, if you find you're out of oil for the cake, you can substitute melted shortening.
What Fat Does
If you're fat-averse or watching your calories, you might wonder why you even include oil or other fats in a cake mix. The fats in cakes or other baked goods make them rich and soften the crumb by preventing the flour's gluten from forming its usual long, stretchy strands. Instead, fats keep the protein chains short -- hence the term "shortening" -- and the cake remains tender. Scratch-made cakes often start with a solid fat, and won't have the right texture if you use oil. Cake mixes call for oil, so solid fats must be melted first.
Vegetable Shortening vs. Vegetable Oil
Commercial shortening is made by treating vegetable oil so it remains solid instead of liquid at room temperature. If you melt it in your microwave it returns to its original liquid form, and can be used in your cake mixes. It's a quantity-for-quantity substitution, so if your cake calls for 2/3 cup of oil, you would use 2/3 cup of melted shortening. For the most accurate measurement, melt the shortening before measuring it. Any excess can be left at room temperature to solidify, and then may be used for greasing pans. Cool the shortening until it's just warm before adding it to your cake mix, or it could produce a denser texture.
Manufacturers convert vegetable oil into shortening by treating it with hydrogen, a process called "hydrogenation." It changes the molecular structure of the oil, extending its shelf life and making it resistant to breaking down and becoming rancid. Vegetable shortening retains its neutral flavor better than vegetable oils in long storage. Unfortunately, hydrogenation also creates trans-fats, which have been implicated in heart disease and many other health conditions. Using shortening as an emergency substitution once in a while isn't a grave health risk, but other options are available.
Most consumers are now aware of the dangers of trans-fats, so many manufacturers have responded by offering shortenings that are non-hydrogenated and free of trans-fats. These can be used the same way as traditional shortenings in your baking. Coconut oil is also solid at room temperature but free of hydrogenation, and can be melted and used if its faint coconut flavor is compatible with your cake. A third option -- if you bake irregularly, and want long shelf life -- is an oil with natural resistance to becoming rancid. High-oleic and mid-oleic sunflower oils both have that characteristic, and mid-oleic sunflower oil is readily available at most supermarkets.