In chapter 263 it was explained that the Shabbos candles take precedence over wine for the daytime Kiddush (sanctification of the day), so that the former is chosen if one's funds are too meager for both. This is because the peace in the home created by the light is a greater priority. The Shabbos candles save one from sitting in the dark and stumbling over objects (see there). It is certain that Shabbos candles take precedence over Chanukka candles, since even the daytime Kiddush, which is a Bibilical obligation, is preempted by Shabbos candles. This is true even if one does not even have bread to recite Kiddush over (bread can be used if no wine is available). It is obvious then that Chanukka candles, which are rabbinic in nature, would not take precedence. Though it is true that there are authorities that believe Kiddush to be a rabinnic obligation, while the Biblical mandate is fulfilled through Shabbos prayers, nevertheless there is a Bibilical basis for it. Also, though Chanukka candles do have a public function of publicizing the miracle, maintaining peace in the home is an even greater overriding concern. However, since one candle would suffice to provide light in the home, one in such a position should purchase one candle for this purpose and use the remainder of the funds for Chanukka candles(Magen Avraham).
If one has candles for Shabbos, but can only afford to buy either wine for Kiddush or Chanukka candles, the candles take precedence, due to the importance of publicizing the miracle. This, however, is only if one has bread to use instead of wine. If one does not even have bread purchasing bread takes precedence. This is true even in the view of the opinion that Kiddush is a rabbinic requirement, as having two loaves for the Shabbos meal [which begins with the Kiddush recitation] has a Biblical basis (Taz). The Bach disputes this and rules that Chanukka candles take precedence even over bread. It appears that the settled law is as the first opinion, for even if there was no question of a Biblical basis it is nevertheless understood that bread in the home is necessary for peace in the home.
The Chanukka candles take precedence over the Havdalah wine as well. However, as was previously mentioned, one can fulfill the Mitzvah of Chanukka with only one candle, so once one candle is available the remainder of the funds should be used to purchase wine for Kiddush or Havdalah.
There is one who states that in this day and age, when Chanukka candles are lit within the home, there is no reason for Shabbos candles to take precedence. This opinion argues that it is better for Chanukka candles to be lit, as they will provide light for the home in any event. Now even though it would normally be prohibited to eat by this light, it should still be preferable to eat by its light than to forgo the Chanukka candles completely, as it is impossible to have them any other way [since he cannot afford both] (Magen Avraham). The Eliyah Rabah, however, disputes this. Nevertheless, one may rely on the first opinion in difficult circumstances, for in regard to the candle light Mitzvah-related uses have been permitted by the dissenting opinion, as I have written in chapter 673, and the Shabbos meal is certainly a Mitzvah.