Tim Cook, chief executive officer of Apple, speaks at the 2019 Dreamforce conference in San Francisco on November 19, 2019.

Apple said it will close all of its stores outside of Greater China until March 27 to reduce the risk of the coronavirus spreading.

The iPhone maker's online store will remain open as well as its "Apple Store" app.

Apple CEO Tim Cook said the company had learnt lessons from the outbreak in China and that is why it is taking these steps.

"One of those lessons is that the most effective way to minimize risk of the virus's transmission is to reduce density and maximize social distance," Cook wrote in a blog post late on Friday. "As rates of new infections continue to grow in other places, we're taking additional steps to protect our team members and customers."

Apple's move follows similar steps it took in China in early February when it said it would temporarily shut down all its stores in mainland China through Feb. 9 because of the coronavirus.

After that it took a while for stores to reopen. By Mar. 13, all of its mainland China stores had re-opened but with limited operating hours. China is a critical market for Apple and its business has been hurt because of the epidemic.