The choice of article has nothing to do with the order in which they appear in a sentence. Broadly speaking, we use the definite article for something specific or unique and the indefinite for something non-specific and countable.
In this example the speaker is saying they always do this check whenever they visit supermarkets. So, it is 'a' supermarket because there are many of them, but 'the' prices because they mean the specific prices in whichever supermarket they happen to be visiting at the time. The price in one may be different from the price in another.
Consider these examples:
I buy an apple every time I visit the supermarket.
This is because there are many apples and they aren't buying a specific one, and they aren't referring to visiting different supermarkets.
I went to the supermarket and spoke to the manager.
This means a specific supermarket and a specific manager (or the only one the supermarket has).