I went to the store a while ago is correct.
Why?
This is a tricky one because both the singular “awhile” and the two-word phrase “a while” have very similar meanings. The adverb “awhile” means “for a period of time,” and the noun phrase “a while” means “a period of time.”
When in doubt about which one to use, there are a few tricks to try. If the phrase “for a while” can be substituted in the sentence, then the correct word is the adverb “awhile.” Example: “I cleaned awhile” means the same thing as “I cleaned for a while.” On the other hand, “I went to the store for a while ago” doesn’t make sense, which means the correct version uses the noun phrase “a while,” as in, “I went to the store a while ago.”
To check whether the noun phrase “a while” is correct, try substituting a specific amount of time, such as “an hour” or “a week.” Example: “I went to the store a while ago” correctly turns into “I went to the store an hour ago.”
A long forgotten trick on when to use “a while” or “awhile”. Thanks for the reminder!