YOU SAID:
when I went to the store I bought a beverage
INTO JAPANESE
店に行ったとき、私は飲み物を買った
BACK INTO ENGLISH
I bought a drink when I went to the store
INTO JAPANESE
店に行くときに飲み物を買った
BACK INTO ENGLISH
I bought a drink when I went to the store
That didn't even make that much sense in English.