When to go shopping: It is best to purchase foods which require further preparation on Thursday, as opposed to Erev Shabbos. Readymade foods, such as beverages and different readymade desserts and the like, are better to be purchased on Friday.
If the store will close and one has not yet Davened what is he to do? If one has not yet recited the Shachris prayer and will be unable to purchase his Shabbos needs after completing his prayer, then he is to first say Shema within its proper time [if applicable] and then purchase his Shabbos needs, delaying his prayer until after the purchase. This applies even if it is possible that due to the purchase he will miss praying within Zman Tefila, nevertheless he is to first make his purchase. If however delaying the prayer until after his shopping will cause one to fail to pray with a Minyan, then he is to first pray [see footnote]. [Likewise if doing the purchase will definitely cause him to fail to pray within Zman Tefila then he is to first pray.]
Verbalizing that the bought produce is for Shabbos: It is proper for one to say on every item of purchase “This is for the honor of Shabbos”. Likewise on all matters that one does it is good to think that he is doing so for the honor of Shabbos.
Designating food for Shabbos as one buys it during the week: Living with the verse “Remember Shabbos and sanctify it” if one sees a nice portion of food during the week he is to designate it for Shabbos. If he then finds a nicer portion, he is to eat the previous portion during the week and designate the nicer portion for Shabbos. This was the custom of Shamaiy, and so agreed Hillel that it should be the practical directive for others. However Hillel himself, as a result of his great trust in G-d would wait [until Friday] to designate food for Shabbos, saying that certainly G-d will grant me the greatest portion [on Friday] in honor of Shabbos.
When to go shopping for Shabbos: Shopping for Shabbos should be done on Thursday for those foods that require preparation. However ready to eat foods are better to be bought on Friday. One should say upon anything he buys that it is being bought Likaved Shabbos.
May one shop before prayer on Erev Shabbos:
One is only to first shop and then pray if all the following apply:
- He will be unable to go shopping afterwards.
- He says Shema prior to the shopping.
- It is not definite that he will miss Zman Tefila due to the shopping.
He will not questionably miss Zman Tefila and also definitely miss Davening with a Minyan due to the shopping. If he will certainly not miss Zman Tefila but will definitely miss Davening with a Minyan he is first to make his purchases, unless he is needed for the Minyan.
 Meaning they require cooking or grinding etc in order to become edible or in order to be served.
 This is in order to give one enough time to prepare these foods as well as the other Shabbos needs. [ibid]
 He must say the Shema prior to shopping even if there may be time left to say it after shopping, as we suspect that perhaps it’s time will pass prior to him finishing shopping. [ibid]
 But not definite, as will be explained.
 We do not suspect that one will come to pass the time for Davening [which is the 4th hour of the day], as we do by Shema, as Davening contains one more hour then does the Shema. Now, although there is room to suspect that this time will too pass until the shopping is complete, nevertheless since the Mitzvah of preparing for the Shabbos meals will definitely be not fulfilled if one Davens first, due to the closing of the stores, while it is possible that he still be able to Daven on time if he go to the store first, therefore he is to first go to the store. [ibid]
 Admur ibid writes that one is to first purchase his groceries and then pray even if there is doubt that he may not be able to pray within Zman Tefila due to this. Nevertheless “if the congregation is praying he is not to separate himself from the congregation”. This implies that if one will miss the Minyan due to the shopping he is to first Daven and then shop.
Other Opinions-Mishneh Berurah: The Mishneh Berurah [250 Biur Halacha “Yashkim”] questions how could the Rabbinical Mitzvah of Davening with a Minyan push off the Mitzvah and obligation to prepare for the Shabbos meal, which is a Biblical command of Oneg Shabbos. Furthermore, even if Oneg Shabbos is only of Rabbinical origin, since one can Daven in private how can we allow Davening with a Minyan to completely nullify the Mitzvah of Oneg Shabbos. He thus concludes that one is to first go shopping, even on expense of missing the Minyan, and then Daven in private.
Opinion of Ketzos Hashulchan: The Ketzos Hashulchan [70 footnote 11] suggests that in truth everyone agrees that Davening with a Minyan alone is not enough to nullify the Mitzvah of Oneg Shabbos, and one is to thus first go shopping in such a case. When however do we say that Davening takes precedence? In a case that in addition to one losing out in praying with a Minyan, there is also possibility that if he shops before Davening, he will miss Zman Tefila, and in such a case that there is possibly two transgressions involved in first going shopping, one is to forgo the shopping and first pray. However if one knows for certain that he will not miss Zman Tefila then he is to first go shopping, even on expense of missing the Minyan. [This opinion of the Ketzos Hashulchan does not contradict the ruling of Admur or the ruling written above, as whenever one goes shopping in the morning there seemingly is doubt he will lose Davening within Zman Tefila, as there is no prediction of how long the shopping will take.]
Vetzaruch Iyun on the above distinction of the Ketzos Hashulchan, as Admur in 90/17 rules that the Mitzvah of Davening with a Minyan which contains the greatest positive command of sanctifying Hashem’s name in public, pushes off even a negative command of not freeing a slave. [This is in contrast to other Poskim, such as Michaber Yoreh Deah 267/79 which do not view any special advantage in Davening with a Minyan regarding pushing off this negative command, and rather rule that all Rabbinical Mitzvos may push off this command of not freeing a slave.] Thus certainly in our case that a) there is a dispute if Oneg Shabbos is Biblical or Rabbinical, and b) It is possible for one to eat at someone else’s house or borrow food, that Davening with a Minyan would push off shopping, even on expense of Oneg Shabbos.
However perhaps one can differentiate between the Halacha here and in 90/17, as perhaps only in a scenario that there will not be a Minyan at all do we say that making a Minyan overrides even a Biblical command. However if there will be a Minyan regardless of if one joins this Minyan, then Davening with a Minyan does not override even a Rabbinical command. This distinction can also be proven from the law that one may not delay praying within Zman Tefila even if he needs to use the bathroom, if he can withhold himself for a Shiur Parsa. However one is to delay praying with a Minyan if he has to use the bathroom even if he can withhold himself for Shiur Parsa. Likewise the law states that if Zman Tefila is passing he is to begin Davening Shemoneh Esrei before the Minyan even though he will miss Davening with the Minyan due to this.
In any event one can deduce from here that if one is the 10th man for a Minyan he may not leave the Minyan and go shopping even if the store will be closing, and even if he will be able to Daven later, after shopping, within Zman Tefila.
 So is implied from Admur and so rules Ketzos Hashulchan 70/5
 Lit. good
 As by doing so the holiness of Shabbos befalls onto that food. [Machatzis Hashekel, brought in Ketzos Hashulchan 70 footnote 13]
 Based on footnote above.