I don't massively subscribe to the 'food affects milk' theory in a big way. I don't believe an onion will find its way into your blood, into your milk, into your LO an upset their stomach. Just seems to go against how I understand biology. Teething seems more likely than something in your diet.
Just keep offering feeds, and don't get frustrated with him if he doesn't take one. He needs to feel as little pressure to nurse as possible. As long as he's still wetting nappies, he's drinking enough to keep himself hydrated and healthy. If you're worried about his weight, try sneaking another night feed in (between 1am and 4am ideally).
I'm sure there's nothing seriously wrong. Just trust that your LO will take what he needs

he won't starve himself