Adding a shadow to a texturesample in a material

Hey there, basically, i have a skybox made from a sphere that has a material, that material is composed of 4 texturesamplecube nodes and what it needs to become a skybox. My problem is that some of the skybox textures are based on night time , so what i want is that the ones that need a shadow cast one, and the ones that don’t need one, don’t cast a shadow, all in the same material. I saw people say use a shadow pass switch, but when i connected it with the texturesamplecube node, the skybox became glitchy, and the shadow was not visible anyways. The blending mode with the shadow pass switch was on masked, Two sided option is on. Any hep is much appreciated.