Kowal_Affiliate - installation and configuration guide
This document describes how to install, activate, and perform the initial configuration of the Kowal_Affiliate module for Magento 2. The guide covers both technical requirements and the practical steps needed to launch an affiliate program in the store.
1. System requirements
The module is intended for:
- Magento Open Source / Adobe Commerce 2.4.7+
- PHP 8.2 or 8.3
At minimum, the Magento project should include the following modules:
Magento_StoreMagento_CmsMagento_CustomerMagento_EmailMagento_QuoteMagento_SalesMagento_SalesRuleMagento_Backend
2. Installation methods
The module can be deployed in the standard way as a Composer package.
2.1. Installation via Composer
The module is distributed as a Composer package. An example process looks as follows:
composer require kowal/module-affiliatebin/magento module:enable Kowal_Affiliatebin/magento setup:upgradebin/magento setup:di:compilebin/magento cache:flush
2.3. Production mode
If the store runs in production mode, after installation it is also worth running:
bin/magento setup:static-content:deploy
3. What the module creates during installation
During installation, the module:
- creates its own database tables related to affiliation,
- extends
quote and sales_order with affiliate fields, - adds customer attributes used for affiliate management,
- creates the default CMS page for the partner program,
- prepares system configuration and cron jobs,
- registers email templates and admin panel resources.
3.1. Default CMS page
After installation, an example partner program page is created:
identifier: affiliate-programtitle: Affiliate Partnership Program
The page is universal and can be used in production after minor content customization.
The patch is idempotent:
- if a page with this
identifier already exists, the module will not overwrite it.
4. Where to find the module configuration
The configuration panel is located at:
Stores -> Configuration -> Affiliate Program
The most important sections:
GeneralCommissionPayoutsAffiliate PortalNotificationsFraudAIReporting
5. Initial configuration after installation
After activating the module, the following configuration order is recommended:
- enable the module globally,
- configure affiliate registration,
- configure commission and hold period,
- set the minimum payout threshold,
- complete the affiliate portal content,
- configure administrator notifications,
- optionally configure AI,
- perform a registration, affiliate click, and order test.
6. Detailed configuration
6.1. General
Enable Module
Global module switch.
If the setting is disabled:
- affiliate tracking should not work,
- the registration form should not work,
- commissions and payouts will not be handled.
Recommendation:
Yes in the production environment after testing is complete,No only while the program is disabled.
Enable Affiliate Registration
Enables the affiliate program application form on the storefront.
If the option is disabled:
- new partners will not be able to register on their own,
- the administrator can still manually mark a customer as an affiliate.
Tracking Cookie Lifetime (days)
Defines the lifetime of cookie-based attribution after a click on an affiliate link.
Examples:
30 for a standard affiliate program,7 for short campaigns,60 or 90 only if the program terms allow it.
Default Redirect Path
Fallback path used when the tracking link does not contain a valid target.
Examples:
/promotionscatalog/category/view/id/12
6.2. Commission
Enable Commissions
Enables commission calculation for affiliate orders.
If the field is disabled:
- affiliation can be recorded,
- but an entry in the commission table will not be created.
Default Commission Rate (%)
Default percentage commission rate.
Example:
10 means a 10% commission on the current calculation base.
Commission Hold Period (days)
The number of days during which the commission remains in pending status.
After this period expires, cron can automatically approve the commission.
Recommendation:
14 as a safe default value,0 only for a very simple program with no return risk.
6.3. Payouts
Enable Payouts
Enables the payout workflow for affiliates.
If the option is disabled:
- the partner will not be able to submit a payout request,
- the administrator can still analyze commissions, but cannot process the payout in the module.
Minimum Payout Amount
Minimum balance required to request a payout.
Examples:
6.4. Affiliate Portal
This section controls the content displayed in the affiliate dashboard.
Dashboard Intro
A short description at the top of the affiliate dashboard.
It should explain to the partner:
- where to find the affiliate link,
- where to view commissions,
- how the panel works.
Program Rules
Visible collaboration rules for the affiliate.
Best practice:
- one rule per line,
- concise and clear messages.
Banner Title
Default title of the sample promotional material.
Banner Subtitle
Short description under the banner title.
Banner Target Path
Default target path for affiliate links and banners.
Examples:
/promotions/springcatalog/category/view/id/24
6.5. Notifications
Enable Notifications
Enables the internal notification system and notification queue.
Admin Notification Email
The administrator email address that should receive the most important operational messages.
If the field is left empty:
- the module can use Magento's default
general address as a fallback in selected flows.
Notification Log Retention (days)
Defines how long notification log entries should be stored before cleanup.
6.6. Fraud
Enable Fraud Checks
Enables basic anti-fraud checks.
Block Self Referral
Blocks the commission when the customer placing the order is also the affiliate connected with that order.
6.7. AI
The AI section is optional and is not required for the basic operation of the affiliate program.
Enable AI
Main switch for AI features.
OpenAI API Key
API key for communication with OpenAI.
The field is stored in encrypted configuration.
AI Model Name
The model used for AI features.
The list of models can be retrieved from OpenAI after the API key is saved correctly.
OpenAI Request Timeout (seconds)
Maximum wait time for a response from OpenAI.
Practical recommendation:
60 seconds for more stable production operation.
Enable AI Diagnostic Logging
Enables diagnostic logging of AI requests and responses.
Useful for:
- integration,
- testing,
- analyzing timeouts and response errors.
AI Diagnostic Max Chars
Maximum length of the logged payload preview.
Enable Affiliate Assistant
Enables the affiliate assistant if the store wants to use this feature.
Enable Weekly AI Reports
Allows cyclical AI summaries to be generated.
Enable Product Knowledge Retrieval
Allows product knowledge from Vector Store to be used.
Enable Program Knowledge Retrieval
Allows knowledge about the affiliate program, FAQ, and documentation to be used.
Product Vector Store Scope
Defines how product_vector_store_id is resolved.
Product Vector Store ID
The Vector Store identifier if the store uses retrieval.
Redact Personal Data
Removes or masks personal data before sending the prompt to the AI layer.
6.8. Reporting
Enable Reporting
Enables report generation and CSV exports.
Export Directory
Directory path where generated exports should be saved.
Example:
var/export/affiliate
7. Configuring a customer as an affiliate
After installation, the module extends Magento customer edit view with affiliate fields.
In customer edit view, you can manage, among other things:
Affiliate ParticipantAffiliate StatusAffiliate Referral CodeAffiliate Website URLAffiliate NotesAffiliate BalanceAffiliate Coupon Discount (%)
7.1. Affiliate Participant
Indicates whether the customer belongs to the affiliate program.
7.2. Affiliate Status
The most important statuses:
PendingActiveSuspendedRejectedBlocked
7.3. Affiliate Balance
The balance is calculated automatically from approved commissions that are ready for payout.
The field:
- is visible in customer edit view,
- should not be edited manually,
- updates automatically after commission changes.
7.4. Affiliate Coupon Discount (%)
This field lets you assign a discount percentage to an affiliate, which will work on their referral_code.
If you enter a value greater than 0, the module:
- will create or update a Magento cart rule,
- will set the coupon equal to the affiliate code,
- will allow customers to use this code as a coupon in the cart,
- will assign the order to the affiliate based on
coupon_code.
Example:
- the affiliate has the code
FMX1FBXXY3 - the administrator enters
5 - the customer enters
FMX1FBXXY3 as a discount coupon - Magento applies a 5% discount
- the module assigns the order to the affiliate.
8. Module cron jobs
The module uses crons in the default group.
8.1. Auto approve commissions
job: kowal_affiliate_auto_approve_commissionsschedule: */15 * * * *
Task:
- checks
pending commissions, - after the hold period expires, changes them to
approved.
8.2. Process notifications
job: kowal_affiliate_process_notificationsschedule: */10 * * * *
Task:
- processes the notification queue,
- marks entries as sent,
- for the email channel, sends transactional messages.
8.3. Cleanup notification log
job: kowal_affiliate_cleanup_notification_logschedule: 30 2 * * *
Task:
- removes old notification log entries according to retention.
8.4. Weekly AI insights
job: kowal_affiliate_generate_weekly_ai_insightsschedule: 0 6 * * 1
Task:
- generates weekly AI insights if the feature is active.
9. CLI commands
The module provides service commands:
bin/magento kowal:affiliate:auto-approvebin/magento kowal:affiliate:process-notificationsbin/magento kowal:affiliate:cleanup-notificationsbin/magento kowal:affiliate:generate-ai-insightsbin/magento kowal:affiliate:export-report
The most useful commands during the initial launch are:
bin/magento kowal:affiliate:process-notificationsbin/magento kowal:affiliate:auto-approve
10. First test after installation
After configuring the module, a simple end-to-end test is recommended.
10.1. Affiliate registration test
- Go to the affiliate registration form.
- Submit the application.
- Check whether the affiliate account has been created.
- Check whether the customer has the
Pending status. - Check whether notification entries have been created.
10.2. Activation test
- Open customer edit view in the admin panel.
- Set the affiliate status to
Active or use the approval action. - Check whether the customer can see the affiliate dashboard.
10.3. Affiliate link test
- Copy the affiliate link from the dashboard.
- Enter the store through this link.
- Add a product to the cart.
- Place an order.
- Check whether the order has:
affiliate_idaffiliate_referral_codeis_affiliate_order = 1
10.4. Affiliate coupon test
- Set
Affiliate Coupon Discount (%) for the affiliate, for example 5. - Save the customer.
- Make sure the affiliate has the
Active status. - In the cart, enter their
Referral Code as a coupon. - Place an order.
- Check:
- whether the discount was applied,
- whether the order was assigned to the affiliate,
- whether a commission was created.
10.5. Payout test
- Approve the commission or wait for auto-approve.
- Check the affiliate balance.
- Submit a payout request.
- Mark the payout as paid in the admin panel.
11. Most common issues after installation
11.1. No commission after an order
Check:
- whether the order has
affiliate_id, - whether commissions are enabled,
- whether the module works after the fix that creates commissions after affiliate data is saved on the order,
- whether a record appears in the
kowal_affiliate_commission table.
11.2. Customer grid does not show the current affiliate balance
Check:
- whether the
customer_grid index has been refreshed, - whether
reindexRow works after saves, - whether the value in customer edit view matches the value in the grid.
If needed, run:
bin/magento indexer:reindex customer_grid
11.3. AI does not respond
Check:
- whether
Enable AI is enabled, - whether a valid
OpenAI API Key has been saved, - whether a model has been selected,
- whether the timeout is not too low,
- whether
var/log does not show errors for the request to OpenAI.
11.4. Notifications are not being sent
Check:
- whether Magento crons are running,
- whether
Enable Notifications is active, - whether entries are saved to
kowal_affiliate_notification_log, - whether you can manually run:
bin/magento kowal:affiliate:process-notifications
12. Recommended starting configuration
For the first production implementation, the following set is recommended:
Enable Module = YesEnable Affiliate Registration = YesTracking Cookie Lifetime = 30Enable Commissions = YesDefault Commission Rate = 10Commission Hold Period = 14Enable Payouts = YesMinimum Payout Amount = 100Enable Notifications = YesBlock Self Referral = YesEnable AI = No at the start if the store does not need AI from day one
13. Summary
After proper installation and configuration, Kowal_Affiliate lets you launch a complete partner program in Magento 2, covering:
- affiliates,
- referral links,
- affiliate codes,
- affiliate discount coupons,
- commissions,
- payouts,
- notifications,
- partner dashboard,
- basic security and automation.