How tun2u/m2-module-klaviyoaddons works
This Magento extension reconciles Klaviyo email marketing consent into Magento newsletter subscriptions. A scheduled cron job or the documented CLI command starts synchronization; the service fetches Klaviyo profiles in pages, identifies non-subscribed profiles, and asks Magento to unsubscribe the matching customer. Admin configuration controls cron timing. The core call paths are visible in excerpts; configuration wiring and some Magento/Klaviyo internals are supported only by README or tree-level context, so they are not expanded into speculative edges.
Main entry points: KlaviyoService.php Sync orchestrator · Connector.php Klaviyo API connector · Logger.php Module logger · Subscriber.php Subscriber updater
Components 12
Sync entry points
- Scheduled sync
Cron/SyncUnsubscribedUsers.php - Manual CLI
Console/Command/Commands.php
Consent synchronization
- Sync orchestrator
Service/KlaviyoService.php - Klaviyo API connector
Model/Connector.php
Magento subscriptions
- Subscriber updater
Model/Subscriber.php
Schedule configuration
- Admin cron settings
etc/adminhtml/system.xml - Cron expression updater
Model/Config/Cronconfig.php
Logging
- Module logger
Logger/Logger.php - Log file handler
Logger/Handler.php
Other components
- Klaviyo API
- Magento newsletter subscriptions
- Magento cron schedule
etc/crontab.xml
Connections 11
- Scheduled sync → Sync orchestrator: invokes
Cron/SyncUnsubscribedUsers.php - Manual CLI → Sync orchestrator: invokes
Console/Command/Commands.php - Sync orchestrator → Klaviyo API connector: fetches profiles
Service/KlaviyoService.php - Klaviyo API connector → Klaviyo API: requests API
Model/Connector.php - Sync orchestrator → Subscriber updater: unsubscribes email
Service/KlaviyoService.php - Subscriber updater → Magento newsletter subscriptions: updates subscription
Model/Subscriber.php - Klaviyo API connector → Module logger: logs failures
Model/Connector.php - Sync orchestrator → Module logger: logs profile errors
Service/KlaviyoService.php - Admin cron settings → Cron expression updater: saves timing
- Cron expression updater → Magento cron schedule: sets cron expression
Model/Config/Cronconfig.php - Module logger → Log file handler: writes through
Logger/Handler.php