The students of Springfield Elementary School take a field trip to the Springfield Glacier at 3:00am. Unfortunately, the glacier has melted almost completely away, and Lisa blames the melt on global warming. She tries to raise the other students' consciousnesses about global warning, but they ignore her and a ranger tries to shut her up. Bart, for his part, plays a practical joke on her as she desperately asks the students to save the glacier. Lisa's pleas go unheard, however, as the students are instead laughing hysterically at Bart's prank (which involves sending farting noises over a walkie-talkie while Lisa tries to talk).
Meanwhile, Homer and Marge go shopping at the Sprawl-Mart and find Grampa working there as a greeter. Grampa gets hurt, loses his people-greeting abilities and asks Homer to take over for him as the people greeter. Homer proves to be a success as a people greeter, prompting the manager to offer Homer a full-time position without any chance of advancement. Homer is pleased with the offer, due to the low expectations, and takes the job.
The next day, Lisa is still angry with Bart and gets a restraining order filed against him. Under the order, according to Chief Wiggum, Bart must remain twenty feet away from Lisa at all times, or he will face more legal consequences. Wiggum shows the family a Gary Busey-hosted videotape, "Get Out of My Dreams and Also Out of My Car: A Guide to Your Restraining Order", which teaches Bart how to live with a restraining order. To make the restraining order more fun, Homer makes a 20 foot pole that can be used to warn Bart when he's less than 20 feet from Lisa and needs to move away. Lisa, however, starts abusing the power of the restraining order and follows him wherever he goes (which in real life would be grounds for having the order removed) and smiling while she repeatedly jabs him with the screwdriver. At school, the order means that Bart can't even enter the school and he is forced to sit outside in the rain. Groundskeeper Willie becomes Bart's mentor later on, which proves difficult due to the shack Willie lives in being unsanitary and the Scotsman's threatening anyone who would try to correct him.
The final straw for Marge is when Lisa coldly kicks Bart out of the kitchen while he and his mom are having a conversation, deliberately knocking over the milk he was still drinking. Marge appeals in Family Court (with Judge Constance Harm hearing the case) to get the restraining order removed. Bart testifies that Lisa has no sense of humor and in the process manages to insult the judge. Furious, Judge Harm increases the restraining order to 200 feet (61 meters as she explains to the Europeans in the back of the courthouse). Bart can now only live at the edge of the Simpson family property.
Now living in a tent at the edge of the property, Bart takes a look at nature and embraces it. He begins living outdoors and runs with a pack of wild dogs. Marge, worried, asks Lisa if Bart has suffered enough. Lisa explains that she has a hard time forgiving Bart, and that she'll only lift the restraining order if she can think of three nice things Bart has done for her (two of which she and Marge come up with).
Meanwhile, at Sprawl-Mart, Homer finds out he's not so much a worker as he is a slave. He is forced to work all night and day without being paid, isn't even allowed to go to the bathroom, and he cannot leave the store because the management had a v-chip implanted in his head that will shock him painfully if he tries. After tearing out the chip (along with a portion of his skull and brain), he lobbies his fellow associates at Sprawl-Mart to shut the store down, but they insist that they have learned to accept the things they cannot change and steal whatever is not nailed down, Homer eventually leaves the store on his own, driving through the front door in a fork lift loaded with several plasma TVs.
Back in the Simpson backyard, Bart builds a giant statue of Lisa using wicker. She actually likes it so much, she forgives him and breaks the 20-foot "poking pole" in half. Just then, Dolph, Jimbo and Kearney show up carrying lit torches and announcing that they're ready to torch the "Wicker Witch of the West." Lisa is at first angry that Bart built the statue just to burn it (essentially, to burn Lisa in effigy), but she decides to forgive him anyway (though only after Bart claims that "The fire represents your musical ability"). Lisa sets the statue on fire, and as it burns, Lisa throws the restraining order and the broken poking pole into the fire. As the closing credits start to roll, the statue keeps burning while the Simpsons play (and dance to) the Herb Alpert tune "Tijuana Taxi".