You can use a litter tray - line it with something absorbent and then fill it with hay for them to sit in and eat. But it is more of just a way to keep hay in one (well, actually two trays, given you need to provide multiple of every item) place. They will toilet where they eat, but they will also toilet in their sleep and piggies can’t be litter trained, they will pee and poop everywhere - getting it in a litter tray is more incidental catching of it rather than anything else. Their whole cage will need to be lined with an absorbent material.
I don’t use litter trays and instead, their hutch is just filled with absorbent shavings/aubiose and then topped with hay