If you're thinking about filing for bankruptcy, chances are you don't have a lot of disposable income. You may be using your credit cards just to survive -- charging your groceries, your utilities, and gas for your car. Some types of credit card use right before you file for bankruptcy can lead to trouble. But if you can show that buying food for your family was a necessity, you should be able to wipe out those charges in your bankruptcy.
If you have credit card debt and file bankruptcy, that debt will be wiped out with your bankruptcy discharge unless the credit card company objects. Credit card companies typically will only object if you made a lot of purchases within a few months of your bankruptcy filing date. The company can object if it believes you committed fraud by using the credit cards with no intention of repaying the debt (because you knew you would file for bankruptcy).
Fraud is difficult to prove, however, and so federal law provides some protections for creditors. Under current bankruptcy laws, the court will presume that fraud is present if you rack up a total of $675 (as of April 2016) in luxury purchases within the 90 days before you file your case, regardless of whether you actually intended to file bankruptcy at the time of the purchase or not. You can always present evidence that shows the presumption is incorrect. However, this presumption of fraud applies only to luxury purchases, not necessities. (Learn more about credit card fraud in bankruptcy.)
If you do spend more than $675 on groceries, gas, diapers, or other necessities within the 90 days prior to your bankruptcy filing and your credit card company objects to your discharge of that debt, the fact that your purchases were necessities will be a defense. If you can prove that you spent the money on items that were reasonable and necessary for the support of yourself and your dependents, the court will allow you to discharge the debt.
The bottom line is that if you must use your credit card to buy groceries or for other necessities because you simply cannot afford it, you can do so, but you may need to present evidence in court if the credit card company raises an objection. Save your statements and receipts so you have proof that the charges were not for luxury items. Otherwise, avoid using your credit cards before filing bankruptcy to avoid the hassle altogether.