First, you'd have to make sure that when you played Charm that you chose to get the on-buy effect rather than the +$2 +Buy.
You buy the Inn. At this stage, you haven't gained the Inn, so its bottom-line effect doesn't trigger, but Charm's on-buy does.
You gain the Witch. It goes to your discard.
You finally gain the Inn you bought. It goes to your discard and its on-gain triggers, so you can shuffle in both the Witch and the Inn.
If you did it the other way around (buy the Witch, gain the Inn), then you'd only be able to shuffle the Inn into your deck, since you hadn't gained the Witch yet.
If the online game doesn't let you do that, then that sounds like a bug.