Having fallen in love with the royal daughter, the swineherd Heinrich persuades her to come to the lawn for a month and see how the pigs graze. Henrietta agrees to come to the princess only when she finds out that Henry has a magic bowler who can sing, play musical instruments and guess who is cooking in the kitchen.
The princess is accompanied by court ladies, who must ensure that the girl behaves in accordance with her high position. A friend of Heinrich Christian demonstrates the extraordinary qualities of a bowler hat, which tells which of the ladies does not cook anything at home, because the hostess always dines at a party, who cooks "chicken" horse meat cutlets, and who only warms up stolen from the royal dinner. Dissatisfied with the revelations of the ladies are asked to quickly move on to dancing. Henry is dancing with the Princess. She really likes him, and the date ends with a long kiss. Suddenly, the king-father jumps out of the bushes. Ladies in a commotion. Outraged by what he saw, the king announces that tomorrow he will give his daughter for his cousin, the next king, and Henry and his friend will be sent out of the country. But Henry is sure that he will marry the Princess anyway.
In the neighboring kingdom, the bride is getting ready to meet. The Minister of tender feelings is concerned: he will have to find out if the real Princess arrives in their domain. The fact is that the King nearly died twice from “terrible” thoughts: he choked on sausage at breakfast, thinking: suddenly the mother of the bride was a naughty girl, and the Princess was not the daughter of the king, but a girl of unknown origin: the second time he nearly drowned, swimming in a shallow spot, suggesting that the Princess herself could be a minx before conspiracy! A great idea occurs to the Minister: under the feather-beds on which the Princess will sleep, it is necessary to put a pea. After all, people of royal origin have such delicate skin! If Her Highness complains of insomnia in the morning, everything is in order; if not, she is not a real princess.
The Princess arrives and immediately asks to make her a bed: she hopes to see Henry at least in a dream. Camerger and the evil governess, who arrived with her, vigilantly guard her. But the Minister, wanting to find out everything about the past of the royal bride, offers them refreshments and puts twelve bottles of strong wine, and sends gendarmes to the bedchamber.
Henrietta can’t sleep: something is just digging into the body through all twenty-four feather-beds! To be distracted, she sings a song that Henry taught her, and suddenly he hears two male voices picking up words. The princess opens the door and sees gendarmes who suddenly ask her to pull their beards. She is at a loss, but still pulls. Beards remain in her hands. Heinrich and Christians dressed as gendarmes. They want to free and take away the Princess. In case this doesn’t succeed right away, He passes the girl a paper with curses written on it (“go to the damn grandmother”, “shut up, full of holes”) and order them to learn and how to scold the groom. Knowing about the pea, he advises the Princess to say that she slept beautifully. Then the King will refuse the wedding.
The escape fails. When all three sneak their way past the intoxicated Minister of tender feelings, the Chamberlain and the Governess, they are noticed. The governess takes the Princess to her room. Henry and Christian manage to slip away.
In the clutter palace: the valet, tailors, shoe cleaners are busy preparing the King's wedding dress. Under the guise of weavers are Henry and Christians. They offer a completely unusual fabric for the royal costume, the secret of which they alone know. They promise to report to the king, but while he is sleeping, he cannot be disturbed. The first Minister checks what the Princess has prepared for breakfast. Make a dish with pies. Henry manages to hide a note in one of them. The King wakes up, he is not in the spirit, he is capricious and angry. The jester manages to amuse him. Now the King is getting down to business. After a conversation with the court scholar and the court poet, the turn comes to the weavers. They talk about their magic fabric: only an intelligent person can see it, and the fabric is invisible to a fool or someone who is not in his place. The king likes the opportunity to find out in this way who he is at his court. The Minister of tender feelings, who appeared, reports that the pea did not interfere with the Princess's sleep, therefore, she is not of noble birth. The king is upset: he will have to drive away the bride, and he was so tuned in for the wedding!
And the Princess, having found Henry's note, searches for him everywhere and pulls at the beard of every bearded man, hoping that he is a disguised lover.
Finally she meets the King, and he immediately falls in love with her. Henrietta responds to his courtesies with curses, as Henry ordered her, but this does not stop the King. He wants to get married - let him sew a wedding outfit faster! We need to look at the magic fabric. But the King himself is scared (suddenly he won’t see her!), And he sends the First Minister. He, too, is afraid and, on a plausible pretext, passes the royal commission to the Minister of Tender Senses, who sends him to the weavers of the court poet. Entering the room, the poet sees empty tables and frames for stretching fabrics. He asks: where is the fabric? Henry and Christians pretend to be amazed - here she is, in front of the guest’s eyes. The poet is in difficulty: if you admit that he does not see anything, then, it turns out, he is a fool. We have to join the praises that the weavers squander their product. The ministers and the King himself, who then visited them, do the same.
The wedding procession is scheduled for the next morning. A crowd is waiting in the square waiting for the King. Here is the Princess in a wedding dress and her father, who arrived for the celebration. When the King comes out, everyone sees a naked man. Cheers shout off. The father king is trying to explain the situation to his cousin, but he is sure that he is dressed as a picture. But suddenly one very smart boy (a small one, but knows the multiplication table!) Breaks the silence with an exclamation: “Dad, but he's naked!” The crowd explodes with indignant shouts at the King. General confusion. The king rushes into the palace, the courtiers behind him. Henry and Christians appear. The princess and her lover are happy. And the Christian announces that the holiday will take place anyway, because the power of love has overcome all obstacles and the lovers have united.