My book of mathematical logic states the facts that, if we call $|X|$ the cardinality of set $X$, then, for any two sets $A,B$ such that $|A|\le|B|$, $$|A\cup B|=|B|\quad\text{ and }\quad|A\times B|=|B|$$
I know that it holds for countable sets, but I would like to understand why it holds in general. The book says that it is provable by using the fact that any set can be well-ordered, but, although I know this fact, I cannot see how $|A\cup B|=|B|$ and $|A\times B|=|B|$ can derive from it. I thank you very much for any answer!
EDIT: although my text says nothing about it, $B$ must be an infinite set, as pointed out by Henrik, Ben and Asaf, and $A$ whom I thank for noticing that. Moreover, as Andrés points out, $A$ must be non-empty.