Left-back McHattie made his debut for the Tynecastle club in August 2011 and has made more than 60 first-team appearances.
Carrick became a first-team regular under then manager Gary Locke at the tail end of last season when he notched five goals in nine outings.
"It's great," said Robbie Neilson, the Hearts head coach. "They're two really promising players for us and I'm really pleased that they're committing themselves to us for the future. The two boys have played a lot of first-team football for us last season and did really well. Hopefully they'll do this same again this year.
"It's a nice wee boost ahead of the Annan Athletic game."
Hearts have also extended the deals of under-20s duo Angus Beith and Liam Smith on two-year contracts and signed 17-year-old goalkeeper Robbie Brown from local side AC Oxgangs FC.