Salad chain Sweetgreen said Thursday that it will accept cash at its six Philadelphia locations starting July 1, when a new law banning cashless stores in the city takes effect.

In addition, Sweetgreen plans to take cash at all locations nationwide by the end of the year, the restaurant chain announced in a Medium post.

“Ultimately, we have realized that while being cashless has advantages, today it is not the right solution to fulfill our mission,” the statement said. “To accomplish our mission, everyone in the community needs to have access to real food.”

Sweetgreen joins Amazon in reversing course. Weeks after Philadelphia and New Jersey passed their cashless bans, Amazon said its cashierless convenience “Go” stores will start accepting cash.

Philadelphia passed a law banning cashless stores in February, and New Jersey enacted a law in March requiring brick-and-mortar retail locations to take cash. Similar legislation has been introduced in Chicago, New York City, San Francisco, and Washington, D.C.

As technology gives consumers more ways to pay, including with their smartphones, some stores have gone cashless to improve efficiency, reduce the risk of robbery, and avoid the hassle of handling cash.

But lawmakers said cashless stores effectively discriminate against poor consumers who do not have access to credit or bank accounts. Nearly 6 percent of residents in the Philadelphia region were unbanked in 2017 and roughly 22 percent were considered “underbanked,” according to the Federal Deposit Insurance Corporation.

The Philadelphia law does exempt some businesses from the cash requirement. Parking lots and garages, wholesale clubs, retailers that accept mobile payments through membership programs, and rental companies can still stop taking cash. Sales made by phone, mail, and online will also be excluded, as well as goods and services sold exclusively to employees.