Get in the habit of writing down what you need ahead of time.
Just ran out of milk. Write it down.
Running low on peanut butter. Write it down.
We're having hamburgers Saturday and we have no ketchup. Write it down.
Did I say to write it down? I did, didn't it?
Armed with your list, then charge out to the store and get what you need.
And no more.