We present linear polarization-dependent soft x-ray absorption spectroscopy data at the Ce $M_{4,5}$ edges of Cd and Sn doped CeCoIn$_5$. The 4$f$ ground state wave functions have been determined for their superconducting, antiferromagnetic and paramagnetic ground states. The absence of changes in the wave functions in CeCo(In$_{1-x}$Cd$_x$)$_5$ suggests the 4$f$,--,conduction electron ($cf$) hybridization is not affected by globally Cd doping, thus supporting the interpretation of magnetic droplets nucleating long range magnetic order. This is contrasted by changes in the wave function due to Sn substitution. Increasing Sn in CeCo(In$_{1-y}$Sn$_y$)$_5$ compresses the 4$f$ orbitals into the tetragonal plane of these materials, suggesting enhanced $cf$ hybridization with the in-plane In(1) atoms and a homogeneous altering of the electronic structure. As these experiments show, the 4$f$ wave functions are a very sensitive probe of small changes in the hybridization of 4$f$ and conduction electrons, even conveying information about direction dependencies.