Meaning of “do the trick” - Learner’s Dictionary

do the trick

If something does the trick, it solves a problem or has the result you want:

If I've got a headache, a couple of aspirins usually do the trick.

(Definition of “do the trick” from the Cambridge Learner’s Dictionary © Cambridge University Press)