The 28-year-old scored three goals in 18 appearances for the Bundesliga side after joining in August 2017.
Dortmund also took to their social media outlets to confirm the deal, while wishing the player good luck for his future endeavors in the Premier League.
The Premier League is the best league in the world and I know that an interesting project is being built here at West Ham.
'The team wants to achieve high things and I am excited for this challenge'.
West Ham remain in advanced talks with Lazio over the signing of midfielder Felipe Anderson and defender Fabian Balbuena from Corinthians.
The 28-year-old Ukraine worldwide becomes the club's fifth summer signing, following the additions of Jack Wilshere (free), Ryan Fredericks (free), Lukasz Fabianski (£7m, Swansea) and Issa Diop (£22m rising to £25m, Toulouse). They become our fourth and fifth new signings of an already busy summer, after the additions of Ryan Fredericks, Issa Diop and Lukasz Fabianski. Borussia Dortmund signed Yarmolenko for roughly the same fee less than an year ago, so to break even despite his disappointing season is a good deal for the club.