〜ついでに
while (you're) at it, on the way
Verb plain form / Noun + の + ついでに
Sign up free to review this point on a spaced schedule.
ついでに means taking the chance to do something extra while doing something else: 買い物のついでに、郵便局に寄った, "while I was out shopping, I dropped by the post office".
The first part is the main purpose; the second is the bonus. It follows a plain verb or a noun with の.
On its own, ついでに means "while you're at it", and it's handy for small requests: コンビニに行くなら、ついでに牛乳も買ってきて, "if you're going to the shop, could you get some milk while you're at it?"
Compare ながら, which is two actions at the same moment. ついでに is about piggybacking one errand on another.
Examples
買い物のついでに、郵便局に寄った。
While I was out shopping, I dropped by the post office.
散歩のついでに、パンを買ってきた。
I picked up some bread while I was out for a walk.
東京に行くついでに、友達に会うつもりだ。
While I'm in Tokyo, I plan to see a friend.
コンビニに行くなら、ついでに牛乳も買ってきて。
If you're going to the shop, could you get some milk while you're at it?
部屋を掃除したついでに、窓も拭いた。
While I was cleaning the room, I wiped the windows too.