I've done it once. And it worked. You just need to be upfront about it. Most people don't mind a plug in exchange for something free. And the ones that get snarky about it (a tiny minority) are not a big deal. The ones that really care will pay you (an even tinier minority).
This works because you're offering something that normally costs money for free. That's psychologically different than offering something for free (with a required plug), but with no option to pay for it.
The other thing is that it needs to be an impulse purchase. I doubt it would work for a Shoppify, for example.
So if you're selling something sort of whimsical, entertaining or trivial, this sort of "forced viral" marketing can work very well.