  Let $(S,\omega)$ be a closed orientable surface whose genus $l$ is at least
two. Then we provide an obstruction for commuting symplectomorphisms in terms
of the flux homomorphism. More precisely, we show that for every non-negative
integer $n$ and for every homomorphism $\alpha \colon \mathbb{Z}^n \to
\mathrm{Symp}_0(S, \omega)$, the image of $\mathrm{Flux}_\omega \circ \alpha
\colon \mathbb{Z}^n \to H^1(S ; \mathbb{R})$ is contained in an $l$-dimensional
real linear subspace of $H^1(S; \mathbb{R})$.
  For the proof, we show the following two keys: a refined version of the
non-extendability of Py's Calabi quasimorphism $\mu_P$ on $\mathrm{Ham}(S,
\omega)$, and an extension theorem of $\hat{G}$-invariant quasimorphisms on $G$
for a group $\hat{G}$ and a normal subgroup $G$ with certain conditions.
  We also pose the conjecture that the cup product of the fluxes of commuting
symplectomorphisms is trivial.
