Josh Duhamel will replace Armie Hammer in action-comedy film Shotgun Wedding, which also stars Jennifer Lopez. 

Hammer dropped out of the movie last month following allegations that he sent sexually explicit messages on social media. 

The 34-year-old actor responded to the allegations by describing them as "vicious and spurious online attacks against me".

Transformers star Duhamel, 48, will now play Lopez's husband-to-be in Shotgun Wedding.

Erin Westerman, president of production for the Lionsgate Motion Pictures Group, said: "We know Josh and Jennifer will make a compelling and sexy on-screen couple and they will be fun sparring partners as their dream destination wedding erupts into a memorable nightmare."

Lionsgate also announced Sonia Braga will play Lopez’s on-screen mother, with Jennifer Coolidge starring as Duhamel’s character’s mother.

Shotgun Wedding will be directed by Pitch Perfect filmmaker Jason Moore and tells the story of a couple who begin to have second thoughts before their wedding.

The situation is further complicated when they are taken hostage by criminals.