I've never walked the WHW, but I have spent plenty of time in rural Scotland, Most stores in Scotland, even in villages, will take credit cards. However most is not all, and you will probably find some that won't. If you are paying for campsites rather than camping wild, or if you are planning on the odd night at a B&B, some will probably only take cash. Even those that take cards will be much happier if you offer them cash. Scottish businesses really like it when they don't have to pay transaction fees. I would recommend keeping a stock of cash on hand sufficient for your next couple of purchases. Even if you aren't intending to buy accommodation, you might like to keep enough cash to pay for a night in a B&B in case of damage to your tent, hurricanes etc.
On the upside there are ATMs at reasonably frequent intervals on the WHW i.e. you will pass one most days, but it's not guaranteed that any given village will have one.. Almost all are private rather than bank machines, so you will pay a fee for withdrawal, as well as any charges from your bank and exchange fees.You should probably check that your card will work in them.
You can invariably use cards for train fares, even if you get on at a small station and pay on the train.
I'm not going to give a figure for how much cash you actually need. Food isn't going to be too different from elsewhere in Europe, and only you know what you are going to want to buy.