You'll want to enable and require the Donation Department Tracking and Donation Fund Tracking fields on the Checkout outcome form. You can edit the Checkout Outcome form in Configuration > Intake & Outcome > Outcome Forms > Checkout:
When a donation is added during checkout, you will receive a pop up when the transaction is completed to assign the proper department and fund to the donation that was added.