LenonLeite WordPress Mautic
Plugin to connect WordPress Woocomerce with Mautic
by Lenon Leite · github.com/lenonleite/lenonleitewordpresswoopluginmautic
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/lenonleite/lenonleitewordpresswoopluginmautic/archive/refs/heads/main.zipSync WordPress users and WooCommerce customers to Mautic contacts.
Features
- Connects WordPress to Mautic using OAuth2.
- Syncs WordPress users when they register or update their profile.
- Syncs WooCommerce customers when orders are created or completed.
- Stores the Mautic contact ID in WordPress user/order meta.
- Applies configurable Mautic tags.
- Adds product purchase tags like
purchased-product-slug. - Can add the Mautic tracking script to the frontend.
Installation
-
Copy this plugin folder to:
wp-content/plugins/lenonleite-wordpress-mautic -
In WordPress admin, go to:
Plugins -
Activate:
LenonLeite WordPress Mautic -
Open the plugin settings:
Settings > Mautic SyncOr direct URL:
/wp-admin/options-general.php?page=llwm-mautic-sync
Connect Mautic
The plugin uses Mautic OAuth2 credentials.
1. Enable the Mautic API
In Mautic admin:
- Go to
Settings. - Open
Configuration. - Open
API Settings. - Enable the API.
- Save the configuration.
2. Create OAuth2 credentials in Mautic
In Mautic admin:
- Go to
Settings. - Open
API Credentials. - Create a new credential.
- Select
OAuth2. - Use the Redirect URI shown on the WordPress plugin settings page.
For production, it should look like:
https://www.example.com/wp-admin/options-general.php?page=llwm-mautic-sync
After saving, Mautic will give you:
- Public Key
- Secret Key
3. Save credentials in WordPress
In WordPress admin:
-
Go to
Settings > Mautic Sync. -
Enter the Mautic URL, for example:
https://m.example.com -
Enter the
Public Key. -
Enter the
Secret Key. -
Click
Save Changes.
4. Authorize with Mautic
After saving the credentials:
- Click
Re-authorize with Mautic. - WordPress redirects you to Mautic.
- Approve the connection in Mautic.
- Mautic redirects back to WordPress.
- The plugin stores the access token and refresh token.
Then click:
Test Mautic Connection
Sync Behavior
WordPress Users
When user sync is enabled:
-
A Mautic contact is created or updated when a user registers.
-
A Mautic contact is updated when a user profile changes.
-
The Mautic contact ID is stored in user meta:
_llwm_mautic_contact_id
Default registration tag:
wordpress-user
WooCommerce Orders
When WooCommerce order sync is enabled:
-
A Mautic contact is created or updated when an order is processed.
-
A Mautic contact is updated when an order becomes completed.
-
The Mautic contact ID is stored in order meta:
_llwm_mautic_contact_id
Default customer tag:
woocommerce-customer
Default completed order tag:
woocommerce-order-completed
Product purchase tags are added automatically:
purchased-product-slug
Example:
purchased-blue-shirt
Field Mapping
Mautic receives fields by alias. The plugin settings page includes field mapping sections for:
- WordPress users
- WooCommerce orders
Each input should contain the Mautic field alias where that value should be sent.
Default WordPress user mapping:
User email -> email
First name -> firstname
Last name -> lastname
Default WooCommerce order mapping:
Billing email -> email
Billing first name -> firstname
Billing last name -> lastname
Billing phone -> phone
Billing address 1 -> address1
Billing address 2 -> address2
Billing city -> city
Billing state -> state
Billing postcode -> zipcode
Billing country -> country
To use custom Mautic fields:
- Create the custom field in Mautic.
- Copy the field alias from Mautic.
- Paste the alias into the matching field mapping input in WordPress.
- Click
Save Changes.
Example:
If you create a Mautic custom field with alias:
wc_billing_phone
You can map:
Billing phone -> wc_billing_phone
Migration
The plugin can sync existing records from WordPress to Mautic.
In WordPress admin:
- Go to
Settings > Mautic Sync. - Make sure Mautic is authorized.
- Check the field mapping.
- Use one of the migration buttons:
Sync Existing WordPress Users
Sync Existing WooCommerce Orders
The migration uses the same field mapping and tags as normal sync.
For safety, each migration action currently processes up to 500 records per click.
Settings
The settings page contains:
Mautic URL: your Mautic base URL.Public Key: OAuth2 public/client key from Mautic.Secret Key: OAuth2 secret from Mautic.Access Token: stored after authorization.Refresh Token: stored after authorization.Add Mautic tracking script: addsmtc.jsto the frontend.Sync WordPress users: enables user sync.Sync WooCommerce orders: enables order sync.Registration tags: tags applied to registered users.Customer tags: tags applied when an order is created.Completed order tags: tags applied when an order is completed.- Field mapping inputs for WordPress users and WooCommerce orders.
- Migration buttons for existing users and orders.
Tags should be comma-separated:
wordpress-user, newsletter, customer
Current Limitations
- Product tags are automatic and based on product slug.
- Manual migration currently processes up to 500 records per click.
- Sync runs during the related WordPress/WooCommerce hook; a background queue can be added later for large stores.
- Only Mautic is supported.