When you buy an animal from Marnie's Ranch, Stardew Valley lets you give that animal a name. If you name that animal the ID of the item you wish to spawn, you will instantly receive that item in your inventory.
Name the animal [117] to receive Anchor.
You can use up to three item IDs in your name, such as [74][45][232].
Stardew Valley lets you choose your name when you start the game. You can exploit this cheat by naming your character the ID of the item you wish to spawn.
Every time the game mentions your name the item will be added to your inventory.
To use this cheat, the name of your character needs to be the numerical item ID of the item you wish to spawn, surrounded by brackets. For example, if you want to spawn Anchor, you would name your character [117].
Whenever the game mentions your name, you will receive this item in your inventory. You can then sell the item.
You can use up to three item IDs in your name, such as [74][80][108].