With joblessness rising and India’s economic woes piling up, Prime Minister Narendra Modi decided to tackle the onion shortage this week. Not only did his administration ban onion exports, it is also cracking down on onion hoarding. Retailers and wholesalers now have strict limits on what they can keep on hand. They have to sell the rest.

The move showed where Mr. Modi is ultimately most vulnerable: the economy.

Outside the country, he has been harshly criticized for his decision to strip Kashmir of its autonomy, send in thousands of troops and effectively cut off much of the disputed territory from the outside world.

His Hindu nationalist government has also pursued an aggressive campaign in northeastern India that threatens to strip hundreds of thousands of people, many of them Muslims, of their citizenship.

But to many people here in India, issues like the price of onions matter most. And the onion crunch comes on top of a series of worrying economic signs. Automakers, biscuit bakers and even the underwear industry have endured their worst year in a long while, with thousands of layoffs looming and no clear turnaround in sight.

Mr. Modi’s decision to circle the wagons around the country’s onion crop and bring prices down is starting to soften the impact on consumers. But it threatens to worsen his long-running dispute with farmers, who say they are often forced to sell their crops at rock-bottom prices to keep city dwellers happy.