Once you are in transonic flight
there will be, by definition, shockwaves forming somewhere on the aircraft. The
first important point is that the shockwave heats up the air, which is an
energy input from the aircraft to the airflow, and this hot air just blows
away. This is an energy loss to the aircraft which shows up as an increase in
drag. So shockwaves always mean a drag increase and the
bigger the shock the more the drag.
The next point is that on the wing,
primarily, the shockwaves upset the boundary layer, increasing airflow
separation and drag. Vortex generators can be used to re-energise
the boundary layer and reduce the amount of extra drag from this source. The
vortex generators don't affect the formation of the shockwave,
they just mitigate their effect when they do form.
Area ruling looks at the aircraft
cross section in 3D and tries to get a good smooth thin form for the aircraft
as a whole, thus reducing shockwave effects and reducing transonic drag. The
"coke bottle" was an early fix. Area ruling is done nowadays in more
sophisticated ways