Let A be a BCK-algebra and f : Ak → A a function. The main goal of this paper is to give a necessary and sufficient condition for ƒ to be compatible with respect to every relative congruence of A. We extend this result in some related algebras, as for example in pocrims.