If you deal with a complex sentence structure (and this one is complex) it helps to peel apart layer after layer.
Let us start with the main sentence:
Wahlweise kann man eine Wohnung natürlich [...] betreten oder [...] bitten.
This translates to One can of course either [...] enter an apartment or ask (for) [...]. "Wahlweise ... or" is not directly translatable (about "electively") but it serves to indicate the possibility to select from two (several) alternatives. Here there are two mentioned, so we use "either ... or". "natürlich" translates verbatim to "naturally", but here it is used in the derived meaning of "of course".
Also of notice is the word order, which is rearranged to emphasize the "wahlweise". The emphasis is on you getting to decide for one or the other alternative.
Time to turn our attention to the other parts:
nach der Erkundigung nach Gepflogenheiten
"Erkundigung" is a Nomen derived from "erkundigen" (a Verb), which itself comes from the (nowadays slightly unusual) Nomen "Kunde", which means about "Information". "erkundigen" is about "ask for information" and "Erkundigung" is the act of doing so. Notice that there is "erkundigen" and "erkunden", the latter means doing reconnaissance or explore.
"Gepflogenheit" is a Nomen that comes from "pflegen" (a Verb), which one meaning is "to do [s.t.] usually". e.g: "Ich pflege spazierenzugehen." I tend to go for a walk. "Gepflogenheit" means "usance" or "customs".
The first "nach" is indeed a temporal "nach" and means "after". The second "nach" is just part of the construction "Erkundigung nach", which in English is usually expressed using a verb - [after] asking for or [after] having found out about.
The whole sentence:
Of course one can, after having asked for customs, enter an appartment either in socks or ask for socks or slippers for guests.