Extending Commerce with new modules
Commerce was built to be extended via modules. But, so far, most of the features we've been building have been part of the core – we haven't extended much in separate packages.
We've just released a couple of extensions that add additional features to Commerce from a standalone package. They illustrate how developers can interact with and extend Commerce.
- MessageBird integration: lets you send text messages from Commerce
- TableRates: enables a new shipping method which lets you configure shipping rates with CSV data based on Magento's TableRates implementation
- UserGroupShipment: allows automatic delivery of User Group access (useful for paid site memberships, for example)
- Gateways Pack #1: contains an Adyen gateway, with more to come
To make it easier for developers to extend Commerce, we've also made available a Module Skeleton which acts as a composer-installable bootstrap for custom extensions, and Randomly Priced Product, a sample module to illustrate how custom product types work. We have plenty of work ahead of us to improve the developer documentation, but these working examples will hopefully help.
All of these modules have their source publicly available on our GitHub profile and they can be all installed via our package provider (except Randomly Priced Product).
MessageBird Integration
The MessageBird integration lets you send SMS text messages from within Commerce. Text messages can be sent automatically by a status change action, or manually from the order view in the dashboard. For example, you could send your customer a text message when their order has been handed over to the carrier.
Learn more about the MessageBird integrationTableRates Shipping Method
With the TableRates shipping method in Commerce, you can use your Magento TableRates shipping rules in Commerce. Simply paste in your CSV, and the shipping method will evaluate them. The CSV contains information about the destination (country/state/zip), the weight, and the shipping fee. Other conditions such as order subtotal and number of items are planned.
Learn more about TableRates for CommerceGateways Pack #1
As we're coming up on our 10th built-in payment gateway, we're going to be releasing further gateways in separate packs. The first pack has been kick-started with support for Adyen and will steadily grow over the coming months based on the gateways customers request.
Learn more about the first Gateways PackUserGroupShipment
Unfortunately, you can't use this package yet, as it needs the upcoming 0.11 release to work its magic. But, when 0.11 is available, the UserGroupShipment module allows automatic "delivery" of User Group access when a customer completes their purchase. This is useful for granting access to paid access to parts of a site.
Learn more about User Group ShipmentsModule Skeleton
The Module Skeleton is a composer project (installed with composer create-project
) that contains all the moving parts of a Commerce extension. Whether you're building a module that listens to specific events, or are planning to create a custom product type, the Module Skeleton provides you with the required bootstrapping.
The skeleton contains an autoloaded module with sample code to load an xPDO package, the XML file and schema build code to create such a package, lexicons, a bootstrap to quickly set it up in development, and even a functional build script to create a transport package for distribution. All from a single command.
Learn more about the Module Skeleton on GitHubRandomly Priced Product
The Randomly Priced Product module is more of a proof of concept than anything else. It shows how a third party can create a custom product with all the different pieces – the xPDO package, the module, a Composer autoloader, and the logic of defining the product type and its methods.
Functionally, it allows the merchant to create a product with a minimum and a maximum price. Then each time the product is added to the cart, it will use a random price between those numbers. There's not a lot of real world applications for this, but it's hopefully a useful example for developers.
Check out the Randomly Priced Product source on GitHubShare the modules you're working on
This is just the tip of the iceberg in terms of what's possible and, of course, we'll be building more modules in the future. But we'd really love to invite other developers in the community to share the amazing things they're making Commerce do. If you have a module you're working on and would like to share, get in touch!