If your hedgehog has a tendency to eliminate in one corner of the cage, you may be able to train it to use a litter box.
Start by putting a litter box made for small animals or kittens in the cage with some soiled bedding inside of it. Place the box in the corner of the cage where your hedgehog normally eliminates. Once it has been reliably using the litter box to eliminate for a few days, gradually replace the bedding with non-clumping, dust-free, unscented cat litter or recycled paper litter.
Training your hedgehog to use the litter box during out-of-cage time might be a bit trickier. Start by placing it in a small, hedgehog-proofed room like a bathroom (be sure to close the toilet lid) and put the litter box in a corner of that room. If your hedgehog eliminates elsewhere in the room, move the box to that spot to encourage your small pet to use it.
Once a hedgehog is reliably using the litter box in this small room, you can move your small pet to a larger, hedgehog-proofed room, bringing the litter box with it.
Encourage your hedgehog to use the litter box by praising it and giving a treat after you see it use the litter box. Never punish a hedgehog for eliminating outside the litter box. This won’t help it learn and may damage its trust in you. Be patient when teaching your small pet to use the litter box, and keep in mind that not all hedgehogs will respond to litter-box training.