L.G.
I don't think you have to buy a gift if you're not attending the party. My son has never received presents from anyone not coming to the celebration. However, he has wanted to buy a friend a gift even if he couldn't go to the party. We have done it a few times when we couldn't attend. He's such a little giver, I can't say no.
He buys it, wraps it, with a note, and brings it to school for the other kid.
Do what feels right for you.