Which scenario does it make sense to use a class instead of multiple variables?

Coding an online store where there are items
with a picture and name
Coding a once-off user-inputted function

Coding an online store where there are items
with a picture and name.