To exit a shop, if you're on a PC, then you can right click, hit esc, or hit x. If you're on a phone, then touch the screen with two fingers. That's also how you open the menu.
thank you