Let $G$ be a group such that
$$G=\prod G_i,$$
where above product is arbitrary. Suppose that there exists a subgroup $H$ of $G$ such that
$$\prod G_i=H\prod G_i',$$
where $G_i'$ is derived subgroup of $G_i$. Let $p_i$ be the projection map from $G$ to $G_i$ for each $i$. Let $H_i$ be the mapping of $H$ under $p_i$. Suppose we know that $$H_i=G_i$$ for each $i$. Then is it true that $$G=H?$$ Any help is appreciated.