Then, politeness suggests you ask if you’re thinking about it.
Otherwise shop owners have many many ways to signal how much they want you to do something or not. Wether the card reader is hidden under the counter or the most prominent thing when you need to pay could be a very clear signal for instance.
Although I've never seen a merchant not prefer cash, except maybe big corporations.