Apps are allowed to track your location in the background. If you go into the Location Privacy settings in Settings, you should see that "Apple Store" is set to always.<p>Additionally, I bet they're using some iBeacons to track when you enter the store. These work over Bluetooth LE and the phone can do different things when it hits a nearby beacon.