It seems to be common practice to say Good Shabbos, Shabbat Shalom or some other variation when seeing another Jew on Shabbos. It seems that Shabbos morning, on the way to Shul, is no different.
However, how is this permitted when we see from Shulchan Aruch 89 that saying Shalom is forbidding before davening since it is one of Hashem’s names?
Further, the Kaf Hachaim, Hilchos Keri’as Shema, 85(7) writes that “Shabbat” May also be one of Hashem’s names, and therefore shouldn’t be said in the bathroom. The same should apply Shabbos morning.
You are bringing up a valid point. The Shulchan Aruch says that we should not go to someone else’s house etc. to greet them and say Shalom, because it is H-shem’s name, and we should be addressing H-shem before we greet others with the honor of saying H-shem’s name. However, if the he didn’t go to the person’s house, but was walking in the street and he met him, technically he is permitted to say Shalom, however the poskim say that it isn’t correct, and he should tell him good morning instead. If however he already said some of the birkas hashachar (morning brachos) he is allowed to tell him Shalom. Additionally, if the other person greeted you this way you are allowed to answer him with Shalom even if you didn’t say any brachos yet. Therefore in order to get around this issue, say some brachos before leaving your house.
Shulchan Aruch O:CH 89-2, M:B 89 16.