This follows from two pretty general observations. 1. Pure submodule of a flat module is flat. 2. $\bigoplus_I A_i$ is a pure submodule of $\prod_I A_i$ (via natural inclusion). For completeness of an answer, here is a definition of a pure module. Both observations above follow easily from equivalence between two definitions below; this equivalence is a bit tricky to prove. Submodule $f: S < M$ of a (left) module $M$ is called *pure*, if one of equivalent conditions are met: a) $N \otimes f$ is injective for any right module $N$; b) $f_*: \operatorname{Hom}(C, M) \to \operatorname{Hom}(C, M/S)$ is surjective for any finitely presented left module $C$. I suggest the book "Rings of quotients" by Bo Stenström for a good introduction to pure homological algebra.