How does foreign trade work in a planned economy? I know that in a planned economy all economic processes are ruled by the state and that there are disadvantages such as too much bureaucracy and that sometimes deals are not always met with demand... But how is foreign trade ran in a planned economy and are there any advantages or disadvantages in such? And how do exporters deal and go ahead in a planned economy?
The trade in itself was not that much different per se but it was restricted and overseen by the government.
For example,  USSR was net oil exporter and most of its oil was sold for US dollars at international market prices and then USSR used dollars to buy imports that government officials decided to import. For example, you can see overview of trade in USSR in Zoeter (1983). This is really not that much different from Russia's state companies selling oil and gas at international markets now.
One peculiarity of trade in many centrally planned economies was that it was not rare to trade in kind, as due to general economic mismanagement most centrally planed economies had very weak currencies so they either had to trade paying with hard currency (e.g. dollars), or trade was conducted in kind as the famous Pepsi -  Stolichnaya vodka/warship in kind trade (yes as bizarre as it might sound that is not typo they exchanged some warships for Pepsi as well).
From economic point of view there is no advantage to government completely overseeing/controlling trade to this extent (I don't think there are many serious economists who would even entertain that as a serious option). A disadvantage of such arrangement is that government faces an informational asymmetry when it comes to the preferences and demand of its population, so when government tries to guess how much goods should it import it will likely get it often wrong resulting in shortages. In fact foreign consumer goods were as a result not even widely avaiable to ordinary citizens (see this Investopedia explainer). As a result foreign imports were often avaiable primarily through special shops (in Russia 'Beryozka') where people had to pay in hard currency effectively excluding ordinary non-privileged people, or through black market.   However, it is hard to disentangle how much this was due to mismanaging trade and how much due to general economic mismanagement under central planning.