Product synchronization
The plugin can automatically synchronize WooCommerce products to Moneybird. This allows you to use your WooCommerce products in Moneybird invoices/estimates that you create manually, and to keep product details such as price and tax rate up to date in Moneybird.
Only simple products and product variations that have a SKU code configured are supported for synchronization. Grouped products, bundles and other composite product types are not supported. Product synchronization can be enabled from the plugin settings page. Once enabled, the plugin will automatically synchronize products in the background on a regular basis. The synchronization process is optimized to minimize the number of API requests that are required, and to avoid unnecessary updates of products that have not changed since the last synchronization.
The following product details are synchronized to Moneybird:
- Name
- SKU
- Price
- Currency
- Tax rate
- Revenue ledger account (if configured)
- Document style (if configured)
It is possible to configure the plugin to automatically delete Moneybird products that correspond to WooCommerce products that have been unpublished or are out of stock. This can be useful to keep your Moneybird product list clean and up to date, but it is disabled by default to prevent accidental deletion of products in Moneybird.
Synchonization mechanisms
The plugin can synchronize products either through the built-in WordPress cron system (default), or through WP-CLI commands that can be scheduled in an external cron system such as cron on Linux. The synchronization mechanism can be configured from the plugin settings page.
WP-cron (default)
When using WP-cron, the plugin will automatically schedule synchronization events at regular intervals. The plugin will attempt to synchronize products every 6 hours, but the actual execution of the synchronization may be delayed depending on the traffic to your website, as WP-cron relies on site visits to trigger scheduled events.
WP-CLI
If you have many products or want more control over the synchronization process, you can choose to use WP-CLI commands instead of WP-cron. This requires WP-CLI to be installed on your server, and some familiarity with cronjob configuration since you will manually need to set up cronjobs to execute the WP-CLI commands at regular intervals.
The plugin provides two WP-CLI commands for product synchronization:
wp moneybird product_sync_full: This command performs a full synchronization of all products. This command is mainly useful for manual synchronization or for initial setup, not for use in cron jobs. Depending on the number of products you have, this command may take a long time to complete since Moneybird restricts the number of API requests that can be made in a certain time window. The plugin will automatically handle these restrictions by performing the synchronization in batches and waiting when necessary, but keep in mind that a full synchronization may take several hours for large product catalogs.wp moneybird product_sync_incremental [timeout] [api_request_budget]: This command performs an incremental synchronization, guaranteed to run within a specified timeout (in seconds) and API request budget. The plugin will synchronize as many products as possible within the given constraints. This command is designed to be run frequently (e.g. every minute within a certain time window) so that all products get synchronized in a timely manner while respecting the API rate limits. Once all products are synchronized, running this command will have no effect until 3 hours have passed since the last synchronization, at which point the products will become eligible for synchronization again if they have been updated in the meantime.
Example cronjob configuration for WP-CLI synchronization:
# Run incremental sync every minuts between 2am and 4am, with a timeout of 25 seconds and an API request budget of 30 requests per execution
* 2-4 * * * wp moneybird product_sync_incremental 25 30