Anthony Shingler, aged 38, exposed himself in Quality Square, Ludlow on Wednesday, May 24.
Shingler, of no fixed abode, pleaded guilty at Kidderminster Magistrates Court to exposure and being drunk and disorderly.
Magistrates handed him a one-year community order, and as part of it he must undertake a six-month alcohol treatment programme.
Shingler must also complete 20 rehabilitation activity days, and pay £185 in prosecution costs and a £114 victim surcharge. He will pay in instalments of £20 per month until the debts are paid off.