(Alan Diaz/AP)

By the time Walmart edited, then removed the racial-slur-filled ad from its website, it was too late — the Internet was already enraged.

On Monday, someone noticed an ad by a seller claiming to be Jagazi Naturals, a Britain-based company that makes hair products tailored for black people. The ad was for a wig cap, which secures hair in place under a hairpiece and anchors the accessory in place.

The size was listed as medium. The color: “n—– brown.”

The ad — complete with the familiar Walmart colors and typography — raced around the Web, a racial flub that was a setback for a company that’s aggressively trying to expand online sales.

Walmart and Jagazi Naturals both apologized and shifted the blame onto an unknown third-party seller.

“We are very sorry and appalled that this third party seller listed their item with this description on our online marketplace,” the Bentonville, Ark.-based company said in a statement on Twitter. “It is a clear violation of our policy and has been removed and we are investigating the seller to determine how this could have happened.”

Jagazi said someone had hijacked its name and that neither the wig cap nor the ad was from the company.

“The real JAGAZI is a 100% black company for black people,” it said in a statement at the top of its website. “People have often used our brand name to try to sell their products. Please be aware. Very sorry for all the distress this has caused. We are feeling the pain here as well. Most shocking!”

But those statements didn’t stop the combination of head-scratching and outrage directed at the companies. Many wondered how a multibillion-dollar company could be so careless.

“Umm, @walmart, we need to have a chat …” Travon Free, a writer for “Full Frontal with Samantha Bee,” tweeted on Monday alongside an image of the product.

Walmart’s Twitter responded: “We agree this is appalling.”

But Free pointed out that Amazon.com has the same product listed, minus the racial slur. (Disclosure: Amazon chief executive Jeffrey P. Bezos owns The Washington Post.)

And it wasn’t just one typo, people pointed out. The slur appeared in the product’s description.

Walmart is, of course, not the first U.S. company to be accused of racial insensitivity. Airbnb recently apologized after Native Americans called an ad about a ‘Sioux-style’ tepee racist. Clothing retailer Gap recently pulled an ad that people said delivered a subtly racist message when a black girl was used as a prop.

It’s a delicate time for Walmart, which is engaged in a battle for online sales supremacy with the market leader, Amazon. Amazon sells 50 million products on its site, including those from third-party sellers, according to the Associated Press.

Walmart.com has thousands of such vendors, though it has never shared the specific breakdown.

Read more: 

How a white kid’s taunt and a black student’s body slam made race their high school’s main subject

‘Now y’all killing kids’: 8-year-old shot while walking home from birthday party

Police say a black man was shot after pulling a blade on officers. A new video raises doubts.

‘We’ve never had anything like this’: Racist, threatening message left on door of black church