And we believe we are well positioned to continue supporting our customers through our unique combination of value and convenience, including our expansive network of more than 17,000 stores located within 5 miles of approximately 75% of the US population.
In total, we expect to execute 2,900 real estate projects next year, as we continue to lay and strengthen the foundation for future growth.
Overall, third quarter net sales increased 17.3% to $8.2 billion, driven by comp sales growth of 12.2%.
We're particularly pleased with the -- and how we delivered significant operating margin expansion, which contributed to third quarter diluted earnings per share of $2.31, an increase of 63% over the prior year.
Gross profit as a percentage of sales was 31.3% in the third quarter, an increase of 178 basis points and represents our sixth consecutive quarter of year-over-year gross margin rate expansion.
SG&A as a percentage of sales was 21.9%, a decrease of 62 basis points.
Moving down the income statement, operating profit for the third quarter increased 57.3% to $773 million, compared to $491 million in the third quarter of 2019.
As a percentage of sales, operating profit was 9.4%, an increase of 240 basis points.
The benefit from higher sales was partially offset by approximately $38 million of incremental investments that we made in response to the pandemic, including additional measures taken to further protect our employees and customers, and approximately $25 million in appreciation bonuses for eligible frontline employees.
Year-to-date to the third quarter, we have invested approximately $153 million in COVID-19 related expenses including about $99 million in appreciation bonuses for our frontline employees.
Our effective tax rate for the quarter was 21.6% and compares to 21.7% in the third quarter last year.
Finally, as Todd noted earlier, earnings per share for the third quarter increased 62.7% to $2.31.
We finished the quarter with $2.2 billion of cash and cash equivalents, a decrease of $760 million compared to Q2 and an increase of $1.9 billion over the prior year.
Merchandise inventories were $5 billion at the end of the third quarter, an increase of 11.8% overall and 5.9% on a per store basis.
Year-to-date to Q3, we generated significant cash flow from operations totaling $3.4 billion, an increase of 103.7%.
Total capital expenditures through the first three quarters were $698 million and included our planned investments in remodels and relocations, new stores and spending related to our strategic initiatives.
During the quarter, we repurchased 4.4 million shares of our common stock for $902 million and paid a quarterly dividend of $0.36 per common share outstanding at a total cost of $88 million.
At the end of Q3, the remaining share repurchase authorization was $1.6 billion.
We also remain committed to returning significant cash to shareholders through anticipated share repurchases and quarterly dividend payments, all while maintaining our current investment grade credit rating and managing to a leverage ratio of approximately 3 times adjusted debt-to-EBITDAR.
From the end of Q3 through December 1, comp sales accelerated increasing approximately 14% during this timeframe, reflecting increased demand in our consumables business.
Also please keep in mind that the fourth quarter represents our most challenging lap of the year from a gross margin perspective filing 60 basis points of rate improvement in Q4 2019.
Finally, we expect to make additional investments in the fourth quarter as a result of COVID-19, including up to $75 million in employee appreciation bonuses, which includes our recent announcement to award approximately $50 million in additional bonuses, bringing our full year investment in appreciation bonuses to approximately $173 million, as well as continued investments in health and safety measures.
During the first three quarters, we added approximately 49,000 cooler doors across our store base.
In total, we expect to install more than 60,000 cooler doors this year.
During the quarter, we completed our initial rollout of this convenient customer package pick-up and drop-off service, which is now available in more than 8,500 stores.
As previously announced, we recently celebrated a significant milestone with the opening of our 17,000th store.
For 2020, we remain on track to open 1,000 new stores, remodel 1,670 stores and relocate 110 stores.
Through the first three quarters, we opened 780 new stores, remodeled 1,425 stores, including more than 1,000 in the higher cooler count, DGTP or DGP formats, and we relocated 76 stores.
We also added produce in more than 140 stores, bringing the total number of stores which carry produce to more than 1,000.
As Todd noted for fiscal 2021, we plan to execute 2,900 real estate projects in total including 1,050 new stores, 1,750 remodels and 100 store relocations.
Additionally, we plan to add produce in approximately 600 stores.
Notably, we expect approximately 50% of our new unit openings and about 75% of our remodels to be in the DGTP or DGP formats.
Our plans also include having approximately 30 stores in our new pOpshelf concept, which Todd will discuss in more detail by the end of fiscal 2021 up from two locations today.
In fact, more than 12,000 of our current store managers are internal promotes and we continue to innovate on the development opportunities we can offer our teams.
The NCI offering was available in 5,200 stores at the end of Q3, and given our strong execution to date, we now expect to expand the offering to more than 5,600 stores by the end of 2020.
Including approximately 400 stores in our NCI lite [Phonetic] version.
This compares to our prior expectation of more than 5,400 stores at year end.
And third, exceptional value with approximately 95% of our items priced at $5 or less.
We're proud of all of the incredible work the team has done in standing up this concept and with the initial work now behind us, we look forward to welcoming additional customers to pOpshelf, as we move forward, our goal of approximately 30 stores by the end of 2021.
We're pleased with the success we are already seeing on this front, driven by higher overall in-stock levels and the introduction of more than 55 additional items, including both national and private brands in select stores being serviced by DG Fresh.
In total, we were self-distributing to more than 13,000 stores from eight DG Fresh facilities at the end of Q3.
We expect to capture benefits from this initiative in more than 14,000 stores from 10 facilities by the end of this year and are well on track to complete our initial rollout across the chain in 2021.
More specifically, I'm pleased to note that during the quarter, we expanded DG Pickup, our buy online, pickup in the store offering to nearly 17,000 stores compared to more than 2,500 stores at the end of Q2, providing another convenient access point for those seeking a more contactless customer experience.
During the quarter, we accelerated the rollout of self checkout to more than 900 stores, compared to approximately 400 stores at the end of Q2, with plans for further expansion as we move forward.

Summary:
And we believe we are well positioned to continue supporting our customers through our unique combination of value and convenience, including our expansive network of more than 17,000 stores located within 5 miles of approximately 75% of the US population.
In total, we expect to execute 2,900 real estate projects next year, as we continue to lay and strengthen the foundation for future growth.
Overall, third quarter net sales increased 17.3% to $8.2 billion, driven by comp sales growth of 12.2%.
We're particularly pleased with the -- and how we delivered significant operating margin expansion, which contributed to third quarter diluted earnings per share of $2.31, an increase of 63% over the prior year.
Finally, as Todd noted earlier, earnings per share for the third quarter increased 62.7% to $2.31.
During the quarter, we repurchased 4.4 million shares of our common stock for $902 million and paid a quarterly dividend of $0.36 per common share outstanding at a total cost of $88 million.
From the end of Q3 through December 1, comp sales accelerated increasing approximately 14% during this timeframe, reflecting increased demand in our consumables business.
Finally, we expect to make additional investments in the fourth quarter as a result of COVID-19, including up to $75 million in employee appreciation bonuses, which includes our recent announcement to award approximately $50 million in additional bonuses, bringing our full year investment in appreciation bonuses to approximately $173 million, as well as continued investments in health and safety measures.
As Todd noted for fiscal 2021, we plan to execute 2,900 real estate projects in total including 1,050 new stores, 1,750 remodels and 100 store relocations.
Notably, we expect approximately 50% of our new unit openings and about 75% of our remodels to be in the DGTP or DGP formats.