They can add signs saying the sky is green, they still need to accept cash as long they are collecting a debt.*
*Fastfood / food trucks are different as you pay before reviving the food.
PS: Though they can ban you from coming back after this. And the payment needs to be reasonable. 10$ for a 9.50$ meal is reasonable a 100$ bill is not.
But when ordering something, you are entering a contract.
By placing a sign saying "We don't accept cash" they are placing a condition under which they'll enter a contract with you.
By ordering, you are implicitly agreeing to that condition.
They can however place signs visible in their store or write it on their menu that they don't accept $100 bills.