To answer this question – No, guinea pigs cannot eat onions at all. Guinea pigs are unlikely to like this vegetable in the first place because of the strong smell and taste but also it could be harmful to their health.
Onions are bad for a guinea pigs health and should not be feed to them at all especially in large quantities.
They cannot eat this vegetable at all and instead should be focused on eating other things such as timothy hay and vitamin C fortified guinea pig pellets.
An occasional small slice for fruit is a good treat but make sure to research what types of fruits they can eat before feeding anything to your piggy. If you are unsure make sure you contain your veterinarian or an employee of a local pet shop.
Other food options include dark leafy vegetables.
As mentioned never feed onions to your guinea pig at all as they are bad for their health and should be avoided.