If the store was extending you credit (ie leave now with the goods and in the future pay us back) they’d be required to accept cash at that point.
That said, there are laws in some jurisdictions against card-only payment policies. I suspect they're not widely enforced for smaller places.
There is no federal statute mandating that a private business, a person, or an organization must accept currency or coins as payment for goods or services.
(There are some specific local laws; generally though it appears not to be the case that you have to accept cash.)
Article I, Section 10, Clause 1:
No State shall enter into any Treaty, Alliance, or Confederation; grant Letters of Marque and Reprisal; coin Money; emit Bills of Credit; make any Thing but gold and silver Coin a Tender in Payment of Debts; pass any Bill of Attainder, ex post facto Law, or Law impairing the Obligation of Contracts, or grant any Title of Nobility.
Variously interpreted, that part about states can't make their own currency may be tangentially important.