Both my mother and I have regular cramps, particularly in hot weather.
Her response it to tip salt on everything. That seems to work really well. But I'm not convinced that a very high salt diet is of longterm benefit. Mind you, she is 82, and has been doing it for 40 years - so what do I know?
My response is to take potassium supplements (cheap as chips from Holland and Barratt). This works extremely well.
No doctor has ever shown any interest, or run any tests - they just glaze over and default to 'lose weight, exercise more!' And ignore anything else.
I suspect/speculate a hereditary problem with absorbing potassium...