Let $(X, \mathcal{O})$ be a ringed space, i.e. $X$ is a topological space and $\mathcal{O}$ is a sheaf of rings on the open subsets of $X$.
I would like to show that for two global sections $a, b\in \mathcal{O}(X)$ and for $U$ an open subset of $X$ it holds that: $$ (ab)|_U=(a|_U)(b|_U). $$ It occured to me while using it for $a=b$ and wondering whether one needs to use affine schemes.
This is baked into the definition of a sheaf of rings, and is not something about algebraic geometry or even about locally ringed spaces. The restriction maps have to be a ring homomorphism, so in particular they have to preserve multiplication.