The better option for a Muslim is to avoid any product containing alcohol when other products are available in the market without alcohol.
Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states the following: “Chocolate liquor is not alcohol; it must be distinguished from liqueur which is alcohol. The former, therefore, is lawful for Muslims to consume, while the latter is not, since we are not allowed to consume alcohol in any shape or form.
As far as vanilla extract is concerned, if it contains alcohol, it is considered unlawful for us to consume; in fact, that is the case when it is “extracted with alcohol as the solvent of choice, from the vanilla bean” and “kept in a solution containing alcohol.” Usually, alcohol is listed as an ingredient on the bottle of vanilla extract; if it has been listed, it is quite clearly forbidden for us to consume.
However, vanilla, we are told, “can also be used in the powdered form. In this form, the beans are either crushed without the addition of alcohol, or they are crushed, dissolved in alcohol and then purified. During purification, the alcohol is distilled off so there is no alcohol remaining.” In this case, there is nothing wrong in using this.
In conclusion: while deciding to use vanilla we must exercise caution and make sure that it is free of alcohol. So read the labels on the bottles or containers carefully, and in case of doubt, check with the company that produces it.

Finally, a brotherly word of advice to the puzzled chocoholic: please exercise restraint and caution. Don’t allow yourself to become a slave of chocolates. Allah says, “…Eat and drink, but do not be extravagant, for God loves not those who are extravagant.” (Al-A`raf: 31)