Ideally the process of mechiras chometz [selling of the chometz to a non-Jew] should take place on erev Shabbos during the fifth hour of the day, in order not to get mixed up between this year and a regular year (Shu”t Maharam Shik, Orach Chaim 120, Shu”t Shoel U’Meishiv 6:55,, however, see Da’as Torah 444:2), however, we write that the sale should only happen just before Shabbos
Some say that one should write in the sales contract, that the chometz needed for the two meals of Shabbos is also sold to the non-Jew, and the non-Jew allows the Jew to use his chometz until Shabbos morning. However, practically the Shu”t Shevet HaLevi (9:115) writes: It’s obvious that we don’t have to be overly wise against what Chazal tell us, and the chometz eaten over Shabbos doesn’t need to be sold (and it’s ok to write on the sales contract that all chometz is sold, besides for what is in such and such a place, which I plan to eat over Shabbos) and we don’t need to confuse people by telling them to do unnecessary solutions, and this was always the custom.
Since the sale happens before Shabbos comes in, one should avoid entering into the places that were sold to the non-Jew over Shabbos. Some say, a temporary eating, i.e. just eating a bit of chometz and then leaving is ok (R’ Mordechai Gross, Tel Talpiyos, Kovetz 61, pg. 14, see also Nitei Gavriel 17:25). Especially as generally speaking we ask that the non-Jew not be particular if we enter his property (areas that were sold to him) temporarily.