As one of the commenters near the top correctly said, the formula $-\Delta G/T = \Delta S_{total}$ only applies when non-compression work is zero. That is, the system is set up so that the only way it can exchange energy with the environment is to expand or contract against some ambient pressure, and to absorb or release heat. In that case, the enthalpy change of the system is equal to the heat absorbed from the environment: $\Delta H = Q$. This comes from the fact that the work done on the system is just $W = -p\Delta V$ at constant pressure. So $\Delta H = \Delta(U+pV) = \Delta U + p\Delta V = Q + W + p\Delta V = Q -p\Delta V + p\Delta V = Q$.
Then you can put that into the formula for total entropy:
$$ \Delta S_{total} = \Delta S + \Delta S_{surroundings} = \Delta S - Q/T = \Delta S - \Delta H/T = -\Delta G/T $$
$\Delta G$ and $\Delta S$ are the Gibbs energy change and entropy change of the system only, while $\Delta S_{total}$ is the entropy change of "the universe", which figures into the most common way of stating the second law (i.e. total entropy never decreases).
In the electrolysis example, however, there is electrical work $W_e$ being done on the chemical system in addition to compression work. So total work is $W = W_e - p\Delta V$. When you put this into the formula for enthalpy change, $\Delta H = Q + W + p\Delta V$, the p-V terms cancel again and you're left with $\Delta H = Q + W_e$. Then substitute $Q = \Delta H - W_e$ in the formula for total entropy, and you get the equation that applies in this situation:
$$ \frac{W_e- \Delta G}{T} = \Delta S_{total}$$