It's possible to construct a "function" $f$ from the class of well-ordered sets to the class of all sets where for any well-ordered sets $A$ and $B$, we have $f(A)=f(B)$ if and only if $A$ and $B$ are order-isomorphic. (I put function in scare quotes because the domain and codomain are proper classes.) Von Neumann's construction of the ordinal numbers achieves this.
My question is, can we generalize this to the order types of all totally ordered sets? That is, can we construct a "function" $g$ from the class of totally ordered sets to the class of all sets where for any totally ordered sets $A$ and $B$, we have $g(A)=g(B)$ if and only if $A$ and $B$ are order-isomorphic? Of course such a function exists by the axiom of choice, but can we actually define such a function? And if so can we make it so that $g=f$ when restricted to the class of well-ordered sets?