I am migrating my plugin to Craft 3 / Commerce 2.
What is the best way to call another plugins method like
craft()->commerce_orders->getOrderByNumber($number) from my plugins service?
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.Sign up to join this community
All of Craft’s core services are available via the
For example, the Elements service would be
In the case of other plugins, most will make their Singleton “instance” available as a property on (or method of) their primary plugin class:
use craft/commerce/Plugin as Commerce; // Maybe a class declaration, and inside your own method… Commerce::getInstance()->getOrders()->getOrderByNumber('abc123...');