Going shopping on an empty stomach can ruin your weight loss program and increase your spending on grocery, a new study has found.

According to researchers from Cornell Food and Brand Lab, people tend to buy more high-calorie food (about 31 percent more) if they go shopping after a short period of fasting.

"People skip meals for all sorts of reasons - dieting, fasting, insane schedules that make you forget to eat. But it doesn't matter why you skipped a meal, it can still make your nutritionist cry - making you buy more potato chips and ice-cream and less baby carrots and skim milk," said Aner Tal, PhD, from the Cornell Food and Brand Lab, lead author of the study, according to a news release.

In the study, 68 people were divided into two groups; with one group getting wheat thins before shopping and the other getting no food.

The study found that hungry participants bought 18.6 percent more food, including 31 percent more of high-calorie foods than participants who had eaten before shopping.

In a related study, researchers analyzed the behavior of shoppers at a grocery shop between lunch and dinner time. Study results showed that people who bought during the "hungry hours" were likely to buy more than people buying during other times of the day.

Another study has shown that when hungry, people opt for food high in carbohydrates over vegetables.

Researchers say that eating healthy food before shopping can be a good way to indulge in excessive shopping.

"Make sure you don't skip a meal, or at least have a snack like apples or string cheese in your office. Breakfast is the most skipped meal, and even having something for lunch that has protein will cut your hunger edge," said Brian Wansink, PhD, co-author of the paper.

The study is published in JAMA Internal Medicine.