Get pikemen (still no bonus against war carts, but they are a good upgrade from spearmen), and swordsmen. Or just a wall of warriors with a bigger wall of archers. Get crossbows ASAP.
On harder difficulties 2 war carts can down a warrior in 1 turn, by then should die to walls and archers. As said above you just have to keep picking them off one by one, whilst keeping archers protected with warriors.
Once you get crossbows/swordsmen/pikemen, ie- outtech them ASAP, they are easy to deal with.
I do think they are insanely OP though. I'm playing my first game as Sumer finally. 3 war carts can take a capital until they build walls. And then you only need an archer or 2. They take 11 turns to build from the off, going down to 5 with the policy. And only cost 220 to buy. By turn 30, I had 6 war carts roaming about taking any capital in sight. I took my continent just after I reached the classical era. Didn't even make use out of oligarchy it was so quick.