Heat butter in a large skillet over medium heat. Cook and stir onion and garlic in hot butter until onion has softened and turned translucent, about 5 minutes. Add cabbage; cook and stir until cabbage has softened, about 20 minutes.
While cabbage is cooking, fill a large pot with lightly salted water and bring to a rolling boil over high heat. Cook gnocchi in boiling water until they float to the top, about 3 minutes; drain.
Stir cooked gnocchi and ham into cabbage mixture and cook until heated through. Season with salt and black pepper.
Notes
You can cut down on the butter a bit by adding or substituting some olive oil or chicken broth. But I wouldn't cut out too much!