Even though it’s perfectly acceptable to say, “I was wondering if you’d like some coffee,” that’s not technically correct written English.
That’s because “if” isn’t the right word to use there. “If” is for conditional sentences, when one half of the sentence depends on the other half of the sentence. For example, you could say, “If it rains, we won’t go to the pool.” Look for a condition in one half of the sentence and a consequence in the other half. If that’s the case, use the word “if.”
In the first example sentence, that’s not the case. My wondering doesn’t depend on you wanting coffee or no. So, I need to use “whether” instead of “if.”
“Whether” is for implied questions. To figure out whether to use “whether,” try adding “or not” into your sentence. If you can add “or not,” use “whether” instead of “if.” (You don’t have to leave “or not” in your sentence, though.)