The unexpectedly hard very-high-energy (VHE; E > 100 GeV) γ-ray spectra of a few distant blazars have been interpreted as evidence for a reduction of the γγ opacity of the Universe due to the interaction of VHE γ-rays with the extragalactic background light (EBL) compared to the expectation from our current knowledge of the density and cosmological evolution of the EBL. One of the suggested solutions to this problem consisted of the inhomogeneity of the EBL. In this paper, we study the effects of such inhomogeneities on the energy density of the EBL (which then also becomes anisotropic) and the resulting γγ opacity. Specifically, we investigate the effects of cosmic voids along the line of sight to a distant blazar. We find that the effect of such voids on the γγ opacity, for any realistic void size, is only of the order of 1 % and much smaller than expected from a simple linear scaling of the γγ opacity with the line-of-sight galaxy under-density due to a cosmic void.