Xero integration for Craft Commerce 2
I released a Craft Commerce plugin that allows you to automatically send Commerce invoices into Xero including contacts, payments and even inventory updates.
I've dealt with Xero and their API on other projects so I thought I'd get something up and running for Craft and see if anyone uses it.
The plugin itself is quite straight forward and currently is only pushing basic order and product information through.
Integrations like these make e-commerce platforms more inviting for clients by saving time and money not to mention it make our jobs as developers much easier.
So how do you set it up?
You'll need to create a private application within Xero and then connect via OAuth using a consumer key, consumer secret and private (self signed) certificate.
You'll also need a Certificate store which can be downloaded from this repo for ease of use. It's generated from Firefox's own Cert store and updated often. see here
Once connected the plugin allows you to map your Chart of Accounts (Account Codes) including:
- sales revenue
- accounts receivable
By default all fully paid orders will be pushed into the queue (you'll need to ensure you're processing the queue frequently) with a delay of 30 seconds (this is reduce the time customers spend waiting for their order to process) and then once the queue has dispatched the job, the invoice will be sent to Xero.
If you need to send existing orders to Xero you can do so by viewing an order and you'll see a "Send to Xero" button which will instantly send the order off to Xero. This button also currently acts as a way to see if an order is already in Xero.
What fields are sent to Xero
I keep an updated list on the Github readme page here.
Due to how different systems calculate rounding if for whatever reason the order total is different to what Xero calculates, an additional line item to account for rounding is added in Xero. Please ensure you have this account code selected under settings.
Multi environment settings
If you require different settings per environment the plugin ships with an example config file
xero-config.php which should be copied into your config folder and renamed to
xero.php. Once this is in place you r can define all the plugins settings for each environment. Note if this file exists all settings will then be read from this file instead of whats in Craft.
- Improve documentation
- Configure Crafts new testing framework to ensure new features don't cause unexpected issues.
- Add multiple hooks/events so developers can further extend if required
- Refunds support
- Admin features like element actions, widgets and different syncing methods
Either by the plugin store (search "Xero") or via composer.
Haven't had enough?Here are few of my most recent brain dumps for you to read or view them all
My First Podcast Experience
My good friends Benet Hitchcock and Josh Smith recently invited me onto their #webdev podcast to chat all things Laravel, Craft CMS and the JAMStack.
Click & Collect plugin for Craft Commerce 2
My latest plugin "Click & Collect" for Craft Commerce allows you to quickly start accepting in-store pickups by providing a custom shipping method and the ability to manage store details.
The Abandoned Cart Plugin for Craft Commerce 2
Abandoned Cart for Craft Commerce 2 is a plugin that provides the ability to send multiple email reminders to customers that have abandoned their carts.
The ultimate tech for you and your new furry friend
Gone are the days where you have to sit at work guessing what your pet is up to at home.