(Reuters) - Procter & Gamble Co’s (PG.N) quarterly revenue and profit beat Wall Street expectations on Tuesday, sending shares up even as the world’s No.1 personal goods company took an $8 billion writedown on its Gillette shaving business.

Boosted by price hikes and strong demand for its SK-II and Olay beauty products, P&G’s organic sales rose 7%. Price hikes contributed 3 percentage points to organic sales growth, a closely-watched metric which excludes items like acquisitions, divestitures and currency effects. Shares rose 4% in premarket trading.

However, P&G reported a net loss of about $5.24 billion, or $2.12 per share, for the quarter ended June 30, due to an $8 billion non-cash writedown of Gillette. For the same period last year, P&G’s net income was $1.89 billion, or 72 cents per share.

Gillette razors, gels and foams are some of P&G’s most internationally distributed products. P&G said the writedown was due primarily to foreign exchange fluctuations, increased competition and a contracting market for blades and razors as consumers in developed markets shave less frequently.

The company has been cutting prices at its grooming business, which includes Gillette, hoping to claw back market share from upstart shaving brands such as Harry’s and Dollar Shave Club. Net sales in the grooming business have declined in 11 out of the last 12 quarters.

Excluding items, the company earned $1.10 per share, beating the average analyst estimate of $1.05.

P&G, like other consumer goods companies, has been raising prices on its products to tackle soaring freight and raw material costs that have dented margins.

Organic sales in P&G’s beauty business rose 8%, boosted by demand for its super-premium SK-II brand and Olay skin care products. In the fabric and home care unit, the company’s biggest business that sells Tide detergent and Febreze air fresheners, organic sales climbed 10%.

The company’s net sales rose 3.6% to $17.09 billion in the fourth quarter, beating analysts’ average estimate of $16.86 billion, according to IBES data from Refinitiv.