"This mainly British colloquial expression is recorded only from the 1960s, but is certainly older. Its origin is uncertain. Some argue it may be from cods, an old term for the testicles that derives from the Anglo-Saxon sense of cod, a bag. It is also suggested that wallop may be connected with the dialect term meaning to chatter or scold (not with the word meaning a heavy blow)."
I'm certainly no expert on British slang, but the above suggests to me the term likely had a sexual meaning. Now, what path that might lead to probably depends on whether the "cods" involved were walloping or being walloped.