There are a few things you need to know about storing coffee. None of them matter, however, if the coffee you just purchased was stale or almost stale.
Coffee has a very short shelf life.
Unfortunately, most chain stores and grocers do not adhere to The 21 Day Rule and the chance of actually purchasing fresh coffee from them is very slight. To keep your coffee fresh as long as possible, select a cool, dry place and use an airtight container. A ziplock bag is better than nothing. Never store your coffee in the refigerator or freezer because it does not help keep coffee fresh and may actually cause pre-staling to occur. Sometimes foods in your refigerator like onions, garlic and cheese can affect coffee flavor causing it to taste funky.