The Pittsburgh Pirates have acquired veteran third baseman Aramis Ramirez in a trade with the Milwaukee Brewers, who will receive Yhonathan Barrios plus cash considerations.

Steve Adams of was one of the first to break the news, adding that Pittsburgh will be taking on the $3 million from the $5.74 million owed to Ramirez, who is set to become an unrestricted free agent after the season. The Brewers also confirmed the deal on Twitter.

The Pirates have struggled on the field and with injuries since the All-Star break, and acquiring Ramirez, who had his first MLB stint in Pittsburgh from 1998 to 2003, should address some of the team’s issues. The Pirates are missing infielders Jordy Mercer and Josh Harrison to injuries; both are expected to be out for at least a month.

The 37-year-old Ramirez, who hails from Santo Domingo, Dominican Republic, played for the Chicago Cubs from 2003 to 2011 before landing with the Brewers in 2012. The third baseman has played in 81 games for the Brewers registering .247 batting average, 11 home runs and 42 RBIs.

Meanwhile, the Brewers will be acquiring a pitching prospect in the 23-year-old Barrios, who had a 2.68 ERA with 17 walks and 21 strikeouts in the minors this season.