The influence of the spin–orbit coupling strength (W) on the structure and two-proton (2p) radioactivity of \(^{18}\) Mg is examined using the spherical Skyrme–Hartree–Fock–Bogoliubov (SHFB) approach with the SLy4 interaction and a mean-field cluster potential framework. Our calculations show that increasing W increases the splitting of the single-proton 1d orbitals. Meanwhile, the 2s \(_{1/2}\) proton state evolves from a weakly bound state into a resonance in the continuum. As W increases, the occupation probability of the 2s \(_{1/2}\) proton state decreases, and its radial density profile near the nuclear surface becomes less diffuse. Furthermore, both the spectroscopic factor S \(_\text {2p}^{^{\prime }}\) and the decay energy \(Q_\text {2p}\) for 2p radioactivity gradually decrease with increasing W, resulting in a longer half-life. When \(Q_\text {2p}\) is held constant, the half-life is significantly enhanced by including S \(_{2p}^{^{\prime }}\) . Meanwhile, it is found that the depth of the diproton cluster potential well increases with W, while the corresponding S \(_\text {2p}^{^{\prime }}\) becomes smaller, indicating that the diproton cluster is considerably looser than the \(\alpha\) -cluster. Additionally, a clear linear correlation is observed between log \(_{10}S_\text {2p}^{\prime }\) and \(Q_\text {2p}\) , as well as between log \(_{10}S_\text {2p}^{\prime }\) and W. The logarithmic half-lives, both with and without the inclusion of S \(_\text {2p}^{^{\prime }}\) , exhibit good linear relationships with W and Q \(_\text {2p}^{-1/2}\) , respectively. Finally, using the experimental \(Q_\text {2p}\) value of \(^{18}\) Mg (3.440(34) MeV), the optimal W is determined to be 1.152(8) \(W_{0}\) with \(W_{0}\) =123 MeV fm \(^{5}\) .