Complex sentence: The law that one can have a maximum of two last names still applies, if one or both of the partners already have a hyphenated name, they have to choose a maximum of two names or keep their birth names.
Split into simpler sentences: The law that one can have a maximum of two last names still applies. If one or both of the partners already have a hyphenated name, they have to choose a maximum of two names or keep their birth names.