The 49ers, who had canceled a dream Girl Scouts sleepover at Levi’s Stadium to host a more lucrative concert at the venue, reversed field Wednesday and put a cherry on top.

The team announced it was rescheduling the Girl Scouts event and footing the bill after this newspaper reported the cancellation Wednesday, triggering a public outcry.

“We are very pleased to have agreed upon a positive resolution with the Girl Scouts of Northern California,” the team said in a statement released Wednesday evening. “Additionally, the San Francisco 49ers have agreed to underwrite the entire cost of the event and have guaranteed that it will not be moved from that date.”

After news of the cancellation broke, and before the 49ers reconsidered, the San Francisco Giants offered the Girl Scouts an opportunity to use AT&T Park for the event on their preferred date.

“This is a great outcome for our girls — not only do they still have this event to look forward to, but because the 49ers are now underwriting the full cost of the event, Girl Scouts will have more funds to spend on programs, camps and outreach,” said Marina Park, CEO of the Girl Scouts of Northern California.

The Niners had signed a contract to host Girl Scouts from across Northern California as a reward for the girls who sell the most cookies during the fundraising sales season that began this week. At a sleepover scheduled for May 14 , the girls would be able to run through the stadium tunnel and burst through a banner like the players, hang out with 49ers cheerleaders, the mascot and the team band, watch movies and eat pizza on the 50-yard line and see their names on the Levi’s Stadium big screen in May.

But on Tuesday, the troops got bad news: The Niners now had a chance to book a concert that would allow the team to sell thousands of tickets, parking permits and concessions, and would need the field for setup the night of the sleepover. The 49ers, who made clear in the Girl Scouts contract they could cancel the event if something bigger came along, chose to host the yet-to-be-announced concert, meaning the Girl Scouts event would be called off and their deposit would be returned.

In a bit of irony, the same day the scouts CEO sent the news to its members, 49ers CEO Jed York tweeted a picture Tuesday of himself at a Girl Scout cookies stand in downtown San Francisco.

The Niners declined to say how much bigger of a payday the concert would be for the 49ers and the Santa Clara Stadium Authority, or who the performer would be in the planned concert, saying the promoter has yet to announce it.

But in a statement, the 49ers called this type of situation rare and said when it happens, they try to help groups to find a makeup date or location, and was working with the Girl Scouts to find “a mutually agreeable resolution.”

“With the fluid nature of bidding for major stadium events, unfortunately occasional conflicts arise between private events and public ticketed full-stadium events,” the team said. “Although it is an unusual occurrence, we notify private event clients prior to booking of that possibility and all private event contracts inform clients of such contingencies.”

The Scouts said the 49ers offered alternative dates for the sleepover in July, but Park said the Girl Scouts didn’t want to be disappointed again if their event was canceled at the last minute. So they had begun planning a different reward for girls who sell the most cookies. About 29,000 girls from Northern California are raising money by selling the cookies this year and about 1,200 girls were expected to be invited to the Levi’s Stadium event.

Already, some of the Girl Scouts had begun working toward the goal they needed to be invited to the event — selling 600 boxes — by setting up their stands outside stores around the Bay Area and beyond. .

“I think the messaging sucks — making lucrative decisions more important than promises to a bunch of little girls,” said Lafayette resident Allison Curletto, whose twin daughters are Girl Scouts. She was, particularly, disappointed in the message it sends to girls who were excited about a sports activity that would traditionally be marketed toward boys.

Other local parents have taken to Facebook to voice their displeasure: “Needless to say, the girls are heartbroken,” one mom from Morgan Hill wrote, adding that she interpreted the decision as meaning money was more important to the stadium operators “than thousands of Girl Scouts who give back to their community year round.” Another mom wrote that her daughter “wanted to cry” when she got the initial news that it was going to be canceled..

By nightfall Wedesday, the 49ers had dried the tears. It is unfortunate that scheduling conflicts of this nature arise from time to time,” the team said in its statement, “but we are dedicated to working through all hurdles with our customers to deliver satisfactory options. The 49ers organization has had a great relationship through the years with the Girl Scouts and we are thrilled to welcome them to Levi’s Stadium.”