Backlash over Target's bathroom policy is costing the retailer more than anyone expected. Joe Raedle / Getty A boycott against Target over its bathroom policy seems to be costing the retailer more than anyone expected.

The boycott started in April after Target announced that it would welcome transgender customers to use any bathroom or fitting room that matched their gender identity.

The announcement triggered an immediate backlash. Critics said the policy opened the door for sexual predators to victimize women and children inside the retailer's bathrooms, and more than 1.4 million people signed a pledge to stop shopping at Target unless it reversed the policy.

But Target didn't back down.

Now shopper traffic is declining for the first time in years, and the company is installing single-occupancy bathrooms in all of its stores to give critics of the policy more privacy. The new bathrooms, which already exist in a majority of Target stores, are costing Target $20 million to install, Fortune reports.

The company revealed its traffic declines last week when it reported second-quarter earnings.

Target's same-store transactions, which is how traffic is measured, fell 2.2% in the second quarter. Overall, sales fell 7.2% to $16.2 billion.

"In the second quarter, our No. 1 challenge was traffic, which affected sales in all of our merchandise categories," Target CEO Brian Cornell said last week on a call with analysts.

Cathy Smith, the company's chief financial officer, added: "Traffic performance showed a meaningful change from prior trend. I want to pause and make it clear that we are not satisfied with our second-quarter traffic and sales performance."

In the past, even the most widespread calls for company boycotts have tended to blow over within a matter of weeks to months.

Chick-fil-A, for example, faced a nationwide boycott in 2012 after Dan Cathy, the son of Chick-fil-A's founder, S. Truett Cathy, set off a fury among gay-rights supporters when he told Baptist Press that the company was "guilty as charged" for backing "the biblical definition of a family."

Following Cathy's remarks, reports emerged detailing Chick-fil-A's many charitable donations to organizations opposed to same-sex marriage.

Despite the backlash, Chick-fil-A's sales soared 14% in 2012.

Investors seem unsure of the long-term impact of the boycott on Target's sales, however.

The retailer's stock is down 1% since the start of the year.