The best way to preserve garlic is the buy them fresh peel them and preserve them in olive oil, another great way to preserve them is to make garlic butter just blend them up and had them to butter, if you're buying them already peeled chances are they're not fresh and they'll go bad a lot faster, it's a good idea not to put them in the fridge. I tried to keep mine at room temperature.
I'm a big lover of garlic and have never seen garlic go bad that quickly! I can easily keep garlic for 2-4 months without issue. It sounds like it might be a quality issue. Have you tried buying garlic from other stores? Here's some tips though: -When buying garlic - examine it. Try to pick one that doesn't have any cracks in the outer shell. It's not horrible if it does, but they stay longer without the cracks. Also be very wary of black specs near the base of the garlic bulb. Those are some kind of mold spore (I think, or maybe a bug) and will spread fast. If there's any black specs, don't even bother buying it because it won't last. I picked up a bad one before and it barely lasted a week. -Keep garlic in a dry, cool, and dark area. The importance of those is listed in their order. Humidity isn't nice to garlic. -Make sure the garlic is getting enough air flow. It doesn't need to be on a window seal, but don't put it in any containers or zip lock bags. I leave mine in the mesh bag on the kitchen counter. You could use a brown paper bag with some holes if necessary. Being with potatoes shouldn't be an issue though. We leave ours in one big basket together. If you want, you could try doing garlic butter. I usually cut up the garlic into little pieces, then mix it in with the butter and refrigerate it. It's usually only good for a week or two this way. I haven't heard anything about it before, but you could try chopping up the garlic and putting it with olive oil and freezing it. I've heard people do this with various herbs to keep them good so it might work with garlic also. I'd suggest freezing it in ice cube trays first so you could just pull out a small amount. Honestly though, it sounds like your store is just selling bad garlic. Garlic is meant to last a lot longer than a mere couple weeks.