'〜ついでに': Incidental Action ('While You're at It / Opportunistically')
[Verb Dict / Ta-form / Noun + の] + ついでに (Taking advantage of an existing trip or action)
'〜ついでに' expresses performing a secondary, convenient side-action while carrying out a primary task or errand ('while you're at it...', 'on the way to...'). The primary purpose is stated in the first clause, and the opportunistic additional task is in the second clause.
⚠ Note: Priority ordering: Clause 1 is always the primary main intention. Clause 2 is the secondary task attached opportunistically.
コンビニへ行くついでに、この手紙を出してきてくれない?
While you're heading to the convenience store, could you mail this letter for me?
大阪へ出張したついでに、昔の友人に会ってきた。
While on a business trip to Osaka, I took the opportunity to meet up with an old friend.