Homeless Mark Devereux stole from a Grantham store because his benefits would not stretch to feeding his drug addiction.
Devereux, 30, admitted shop theft after attempting to steal a Philips razor worth £279.99 from Boots in High Street.
Giles Tyas, defending, said Devereux’s problems began when he lost his job as a labourer in April. He then lost his accommodation and turned to heroin.
Mr Tyas said: “He found his benefits were not enough to sustain his lifestyle and that is why he committed this offence.”
However, Mr Tyas argued there is now a “glimmer of hope” for Devereux as he is receiving help from Addaction.
Devereux was sentenced to a nine-month community order with supervision and must pay a £60 surcharge.
Chair of magistrates Jane Tidswell told Devereux: “It won’t take much doing if you turn up and put a full day’s work in. You might even enjoy it.”