Chat on WhatsApp

What's wrong with using preferences for everything?

Preferences don't compose. Two modules that both preference the same class can't coexist, whichever loads later wins, and the loser's logic vanishes silently. In a Magento store with 30+ third-party modules, this is roulette. Plugins compose: ten modules can around-plug the same method and they all run, ordered by sortOrder. The fix: 90% of the time you want a plugin, not a preference. Reserve preferences for: replacing a non-public method, overriding a final class, or changing constructor signature. And even then, prefer a virtualType + plugin first.

Was this helpful?