When using the WooCommerce plugin for WordPress, ecommerce transactions are managed via orders. There are several potential statuses for an order, and not all of them mean that a purchase has been completed. For this reason, Matomo will ignore orders with a status equal to any of the following:

  • cancelled
  • failed
  • refunded

However, as WooCommerce is open source and extensible, it is possible that your site uses additional status codes. If there are custom order management status codes that do not represent a purchase, you can exclude these. This will prevent Matomo’s WooCommerce tracking from providing inflated ecommerce analytics.

To define which order statuses that Matomo should ignore, first you need to find your wp-config.php file. This is typically within the root folder of your WordPress installation. You then need to edit and then the following code, adding the extra status codes that you would like to ignore:

if ( ! defined( 'MATOMO_WOOCOMMERCE_IGNORED_ORDER_STATUS' ) ) {
    define( 'MATOMO_WOOCOMMERCE_IGNORED_ORDER_STATUS', [ 'cancelled', 'failed', 'refunded' ] );
}

In the example above, we have included the additional status awaiting-payment-clearance. If you just have one extra status, you can replace that with the custom status you’d like to include. Alternatively, you add multiple status codes by appending them to the array with a comma and the status surrounded by single quotes.

For example, the following section of the code:

[ 'cancelled', 'failed', 'refunded' ]

If you were to add three additional order status, could become:

[ 'cancelled', 'failed', 'refunded', 'awaiting-payment-clearance', 'awaiting-fulfillment', 'backordered' ]

Once you have updated the wp-config.php file, make sure to save your changes. Matomo will immediately start ignoring future orders with the defined status codes. However, it is important to note that this will not ignore any orders that were tracked with these status codes before you made the update.