← Projects

Xero integration for Craft Commerce

October 19, 2019

👋 This plugin has been picked up by my friend Josh Smith who has since released version 1.0

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
  • shipping/develiery
  • rounding

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.

Roadmap 🚀

  • 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.