After Shrek and Fiona return from their honeymoon, they are invited to a royal ball thrown by Fiona's parents to celebrate their marriage. Shrek is reluctant to participate, reasoning that he is worried about how Fiona's parents would react to her new look. Donkey appears, wanting to move in with them after a fall-out with Dragon, much to their consternation. They all travel to the kingdom of Far Far Away and meet Fiona's parents, King Harold and Queen Lillian, who are surprised by Fiona's choice of husband and her new appearance. Harold is repulsed, and at a family dinner, he and Shrek get into a heated argument over how Shrek and Fiona will raise their family. Fiona, disgusted at their behavior, locks herself in her room, where she meets her Fairy Godmother, who is also startled by Fiona's new looks and marriage. Subsequently, King Harold is accosted by the Fairy Godmother and Prince Charming, her son. He had arranged with the Fairy Godmother that Charming would marry Fiona and they demand that he gets rid of Shrek. Shrek worries that he and Fiona aren't meant to be, particularly after finding a diary from her pre-teenager years and discovering that she was once infatuated with Prince Charming. Harold arranges for Shrek and Donkey to join him on a hunting trip, which is really a trap to lure the two into the hands of an assassin, Puss in Boots.
When Fiona realizes that Shrek left, she asks her father for help, but he replies that he always wanted the best for her and that she should think about that too. Puss is unable to defeat Shrek and reveals that he was paid by Harold. He asks to tag along as a way to make amends. Shrek decides to go to the Fairy Godmother for help. However, the Fairy Godmother states that ogres do not live "happily ever after" and refuses to assist him. Nonetheless, the three sneak into the Fairy Godmother's potion factory and steal a "Happily Ever After" potion that Shrek believes will ensure a happy ending for his marriage. Shrek and Donkey both drink the potion, which doesn't appear to work. They wait out the storm in a barn and Shrek and Donkey become dizzy and fall over into a deep sleep. The next morning the potion has taken effect: Shrek is now a handsome human, while Donkey has turned into a white stallion. To make the change permanent, Shrek must kiss Fiona by midnight. Shrek, Donkey, and Puss return to the castle to discover that the potion has also transformed Fiona back into her former human self. However, the Fairy Godmother, having learned of the potion's theft, sends Charming to the castle, where he poses as Shrek to win Fiona's love. Although Harold recognizes Charming for who he really is, he doesn't speak up. Shrek, heartbroken, lets Fiona go, believing she will be happier with Charming.
A few hours later, Shrek overhears Harold telling the Fairy Godmother that Fiona hasn't fallen for Charming. She gives him a love potion for Fiona, which will cause her to fall in love with the first person she kisses. Harold at first refuses, but the Fairy Godmother threatens to take away his own "Happily Ever After" if he does not listen to her. After hearing that Charming is the Fairy Godmother's son, the trio is noticed by the Fairy Godmother, who has them arrested by the royal guards and thrown into a dungeon. When the royal ball begins, several of Shrek's friends band together to free the trio (having seen their arrest via the Magic Mirror) and help Shrek stop the kiss. The Muffin Man helps them create a gigantic gingerbread man named Mongo, who breaks through the castle's defenses. However, he falls into the moat. When Shrek arrives, Charming forcibly kisses Fiona, believing the potion has taken effect, but Fiona temporarily knocks him out with a headbutt. When the Fairy Godmother confronts Harold, he reveals that he drank the potion himself at the last minute, having realized Fiona's love for Shrek. The Fairy Godmother tries to kill Shrek, but Harold sacrifices himself to save the couple. The spell reflects off his armor and kills the Fairy Godmother into a cloud of bubbles and tears; it also reverts Harold to his true form, that of the Frog Prince. Harold apologizes to Shrek and Fiona for everything he has done, and now realizes what is best for Fiona, giving them his blessing. Shrek forgives him, and Lillian tells Harold that she still loves him no matter what. When it is midnight, Shrek tells Fiona that if they kiss now, then their change will be permanent. But Fiona says that she wants what any other princess wants: to live happily ever after with the ogre she married. The clock chimes as the potion's effects wear off, with Donkey changing back as well, much to his chagrin. He cheers up as Shrek reassures him he still is a noble steed in his eyes. Finally, Puss and Donkey sing as the royal ball resumes celebrating the true newlyweds.
In a post-credits scene, Donkey complains to Puss about missing Dragon, and rejects his invitation to a night-cap at the "Kit-Kat Club." Suddenly, Dragon flies in, along with six "Dronkeys" that Donkey happily embraces as his "mutant babies," and Donkey and Dragon reconcile. Having a larger family, Donkey realizes, "I've gotta get a job!"
- Knockout, Puffer, Dolphy, Rachel, Mighty Joe, Daylight, Jenny, Pete, Kevin, Alberto, Morley, Blitzer, Blythe Baxter, Zoe Trent, Pepper Clark, Penny Ling, Vinnie Terrio, Sunil Nevla, Minka Mark, Russell Ferguson, Gail Trent, Mitzi, Buttercream Sunday, Sugar Sprinkles, Nutmeg Dash, Captain Cuddles, Youngmee Song, Sue Patterson, Jasper Jones, Team Griffin/Eeveelution, The Griffin Family, Vinny Griffin, Glenn Quagmire, Cleveland Brown, Joe Swanson, Little Bear, Duck, Cat, Owl, Hen, Emily, Lucy, Doug Funnie, Skeeter Valentine, Roger Smith, Bender Bending Rodríguez, Minerva Mink, Master Shake, Meatwad, Frylock, Pazu, Sheeta, The Crystal Prep Girls, Wubbzy, Widget, Walden, Daizy, The Young Six (Silverstream, Smolder, Ocellus, Sandbar, Gallus, and Yona), Natsu Dragneel, Lucy Heartfilia, Gray Fullbuster, Erza Scarlet, Wendy Marvell, Happy, Carla, Tempest Shadow, Grubber, Songbird Serenade, Capper, Captain Celaeno, Princess Skystar, Queen Novo, Hiro, Charlie, Sunset Shimmer, Skarloey, Rheneas, Sir Handel, Peter Sam, Rusty, Duncan, Victor, Kevin, Duke, Lady, Trevor, Duck, Donald and Douglas, Oliver, Toad, Spencer, Arthur, Murdoch, Rosie, Stanley, Annie and Clarabel, Henrietta, Paxton, Mavis, Jack, Alfie, BoCo, Daisy, Ryan, Skiff, Mike, Rex, Bert, Zecora, Princess Ember, Gabby, Babs Seed, Coloratura, Moon Dancer, Minuette, Lemon Hearts, Twinkleshine, Barrington, Northumberland, Pugwash, Stewiacke, Owen, Rebecca, Constance, Sir Topham Hatt, Princess Celestia, Princess Luna, and Barret Barricade guest star in this film.
- Queen Chrysalis and Trixie will make climax appearances in this film.
- The storyline continues in Thomas and Twilight Sparkle's Adventures of Shrek the Third.
- Prince Charming/Shrek and Fiona's honeymoon
- The Invitation
- Heading to Far Far Away
- In Far Far Away/Meeting King Harold & Queen Lilian/reunion with some of the others
- At Dinner/Thomas and Twilight's argument
- Fairy Godmother's intro/The Fairy Godmother song
- Fairy Godmother's offer/Shrek and Fiona's argument
- That night/The Poision Apple/Hiring the killer
- Back at the castle/reading Fiona's diary/Shrek, King Harold, and Sir Topham Hatt's midnight talk
- Cadance captured!
- The next morning/in the woods/Puss in Boots
- Where's Shrek?
- The Potion Factory
- Drinking the potion/that night/Shrek, Donkey, and Fiona's transformations
- The next morning/Shrek's surprise
- Heading back to Far Far Away
- Shrek gives up/the discovery/arrested!
- Harold gives Fiona the wrong tea/prison breakout
- Stopping the kiss/"I Need a Hero"
- Final showdown
- Shrek, Donkey, and Fiona change back/ending
- Blooper Reel
- Accidentally in Love
- Fairy Godmother's Song
- I Need Some Sleep
- I Need a Hero
- Livin' La Vida Loca
- You're So True (end credit song)