Advanced Affiliate Module for Magento 2

€114.16 €92.81
COMPOSER Installation
M2-AFFILIATE
PayPal PayPal
Przelew Przelew

Magento Modules: Clear Guidelines

You purchase the module once, with no domain restrictions

Tooltip

Free installation and updates via Composer

Tooltip

Affiliate Program

Tooltip

Technical support for Magento

Tooltip

Clear guidelines for licensing Magento modules

Tooltip

Magento Module Code Security

Tooltip

1. What is this module?

The module extends Magento 2 with a complete affiliate system that runs directly inside the store. This means the store owner manages partners, commissions, settlements, and promotional materials from the store's own admin panel, while partners use their own dashboard in the customer account.

In practice, the module lets you implement several collaboration models at the same time:

  • a classic affiliate program based on tracking links,
  • a referral program based on individual partner codes,
  • a hybrid model: affiliate link plus discount code,
  • a partner program for store customers, agencies, implementation teams, and creators.

2. Core business value

The module's greatest value is combining sales, attribution, settlements, and partner management in one place. The store does not need to maintain an external affiliate system, manually export orders, or settle partner commissions in spreadsheets.

The module gives the store owner:

  • a new sales channel,
  • control over collaboration rules,
  • transparent commission and payout handling,
  • clear reports on affiliate performance,
  • the ability to safely launch a program also in medium- and large-scale stores.

The partner receives:

  • their own referral code,
  • their own affiliate link,
  • a ready-to-use panel for monitoring activities,
  • visibility into commissions and payouts,
  • the ability to use promotional materials and banners.

3. Who is this module for?

The module is suitable for stores that want to build a network of sales partners without using external affiliate platforms, or that want to maintain full control over data and the settlement process.

It works especially well in projects where the affiliate program is intended for:

  • customers recommending the store to friends,
  • online creators,
  • bloggers and publishers,
  • specialists and consultants,
  • implementation partners,
  • software houses and agencies,
  • resellers and B2B sales representatives,
  • brand ambassadors and communities.

4. Key module features

4.1. Affiliate registration

The module provides an application form for the affiliate program. A customer can apply to join the program independently by providing basic contact details, the website or channel address, and a short description of the planned promotion.

After the form is submitted:

  • an affiliate account is created,
  • a unique referral_code is generated,
  • the application status is set to Pending,
  • the administrator can receive a notification about the new application,
  • the customer can receive confirmation that the application has been accepted for review.

4.2. Partner approval

The administrator can approve an affiliate from the Magento panel. After approval:

  • the partner status changes to Active,
  • the partner can fully use the program,
  • it is possible to activate the affiliate coupon,
  • the customer can receive a message confirming participation approval.

Each affiliate receives their own affiliate link based on referral_code. The link works through a tracking controller and records visit attribution. After a click, the system can:

  • save the affiliation in a cookie,
  • create a visit entry,
  • create an attribution entry,
  • connect a later order with a specific affiliate.

4.4. Affiliate code and discount coupon

The module also supports a model in which referral_code can work as a discount code in the cart.

The administrator can set the following field on the affiliate account:

  • Affiliate Coupon Discount (%)

If the value is greater than zero, the system:

  • synchronizes the native Magento Cart Price Rule,
  • sets the coupon code equal to referral_code,
  • applies a percentage discount in the cart,
  • treats the use of this code as the source of order affiliation.

As a result, the affiliate can promote:

  • a standard affiliate link,
  • the discount code itself,
  • a combination of both mechanisms at the same time.

This is one of the module's most practical sales features, because many store owners expect a partner not only to drive traffic but also to give the customer a specific price benefit.

4.5. Order attribution

The module can assign an order to an affiliate based on:

  • a click on an affiliate link,
  • active attribution stored in the session or cookie,
  • use of an affiliate code in the cart,
  • a logged-in customer connected with active attribution.

The following data is saved at the order level:

  • affiliate_id,
  • affiliate_attribution_id,
  • affiliate_referral_code,
  • is_affiliate_order,
  • affiliate_commission_amount,
  • affiliate_commission_status.

This makes it possible to report the sales source directly on quote and sales_order.

4.6. Commission calculation

A commission is created automatically for an affiliate order. In the current model:

  • the commission is calculated as a percentage of the order subtotal,
  • the default rate comes from the module configuration,
  • the system avoids duplicate commissions for the same order and affiliate,
  • the result is saved in the commission table and on the order.

Supported commission statuses include, among others:

  • pending,
  • approved,
  • ready_for_payout,
  • paid,
  • rejected,
  • cancelled,
  • charged_back.

4.7. Hold period and automatic approval

The module supports a commission hold period. This means the commission does not have to be ready for payout immediately. It can remain in pending status for a defined time and only be automatically approved by cron after the specified period has passed.

This solution is especially important for:

  • return risk,
  • manual order verification,
  • sales models with delayed completion,
  • the need to protect the program against abuse.

4.8. Payouts for affiliates

A partner can submit a payout request if the minimum threshold has been met and the partner has a sufficient approved balance.

The payout workflow includes:

  • submitting a payout request,
  • assigning commissions to the payout,
  • changing the commission status to ready_for_payout,
  • marking the payout as paid,
  • changing commission statuses to paid.

This allows the store owner to manage payouts in an organized and auditable way.

4.9. Fraud prevention

The module includes a basic anti-fraud layer that helps eliminate the most obvious abuse.

This includes, among other things:

  • blocking self-referral,
  • marking commissions as rejected when abuse is detected,
  • handling fraud cases,
  • recording rejection reasons,
  • a separate admin-side view for fraud cases.

In addition, the module supports:

  • order cancellations,
  • chargebacks,
  • refunds through creditmemo,
  • commission status changes after returns.

4.10. Notifications

The module has its own notification queuing and processing system. It can record operational events and send email messages.

Supported cases include, among others:

  • a new affiliate application,
  • confirmation that the application has been received,
  • affiliate approval,
  • commission events,
  • payouts,
  • fraud alerts.

4.11. Affiliate panel

The partner uses an advanced dashboard in the Magento customer account. The dashboard is not just a list of commissions, but a complete operational panel.

The affiliate panel includes:

  • program participation status,
  • referral code,
  • full affiliate link,
  • default target path,
  • commission summary,
  • commission history,
  • access to payouts,
  • collaboration rules content,
  • ready-made promotional snippets,
  • banner preview,
  • AI banner generator.

4.12. AI banner generator

The module includes an AI-assisted feature that lets the affiliate prepare a ready-to-use promotional banner based on a brief.

The user can provide:

  • a text brief,
  • visual direction,
  • colors,
  • style,
  • an optional image URL,
  • an optional target link.

The system passes the following to the AI layer:

  • the user's brief,
  • referral link,
  • target path,
  • technical requirements for the response format.

The generated banner HTML can be saved on the affiliate account and used by the partner as ready-made promotional material.

4.13. Reporting

The module supports reports and CSV exports for key program areas:

  • commissions,
  • payouts,
  • fraud cases,
  • AI insights.

This makes both day-to-day program management and partner performance analysis easier.

5. Admin panel

The module extends the Magento admin panel with affiliate program configuration and management.

The administrator has access to:

  • global program settings,
  • commission settings,
  • payout settings,
  • affiliate portal settings,
  • notification settings,
  • fraud settings,
  • AI settings,
  • reporting settings.

In addition, the panel includes operational sections:

  • Affiliate Commissions,
  • Affiliate Payouts,
  • Affiliate Fraud Cases,
  • Affiliate Reports.

Affiliate data is visible on the customer list and in customer edit view, such as:

  • program participation,
  • affiliate status,
  • affiliate balance,
  • referral code,
  • affiliate coupon discount percentage.

6. How affiliation works in practice

6.1. Affiliate link scenario

  1. The partner receives their link.
  2. The customer clicks the link and lands in the store.
  3. The system records the visit and attribution.
  4. The customer places an order.
  5. The order is assigned to the affiliate.
  6. A commission is created.
  7. After the hold period expires, the commission can be approved.
  8. After meeting the conditions, the partner can submit a payout request.

6.2. Affiliate code scenario in the cart

  1. The partner publishes their affiliate code.
  2. The customer enters the code in the cart.
  3. Magento applies the discount from the cart rule.
  4. The module recognizes the code as an affiliate code.
  5. The order is assigned to the affiliate.
  6. A commission is created according to the program rules.

6.3. Hybrid scenario

The customer can first enter the store through an affiliate link and then use the affiliate's discount code. This model allows classic tracking to be combined with benefits for the end customer.

7. Security areas

The module has been prepared with production deployment in mind, so it includes:

  • audit records,
  • support for returns and cancellations,
  • self-referral blocking,
  • a notification queue,
  • mechanisms that limit commission duplication,
  • secure storage of AI configuration,
  • limiting data sent to the AI layer,
  • the ability to diagnose integration errors.

8. AI integration

The AI layer in the module is optional and does not block the core affiliate program from working. It can be used for:

  • an affiliate assistant,
  • generating insights,
  • generating banners,
  • retrieving product knowledge through vector_store_id.

The module does not need to maintain its own product database for AI if the store already uses an external module that manages product knowledge and Vector Store.

9. Sales use cases

The module can be sold as a solution for several types of projects:

  • B2C stores with a referral program,
  • premium stores that want to build a network of brand ambassadors,
  • B2B businesses with a program for sales partners,
  • digital and software stores,
  • agency implementations where the client needs a full partner program without an external SaaS.

Especially strong sales arguments include:

  • full control over data,
  • no subscription for an external affiliate platform,
  • integration with Magento 2 without intermediaries,
  • support for affiliate links and coupons,
  • a ready-made partner panel,
  • the ability to further expand with AI.

10. Key advantages of the module

The most important advantages of this solution are:

  • it works directly in Magento 2,
  • it supports both affiliate links and affiliate codes,
  • it supports discount coupons connected with affiliates,
  • it allows partner management from the Magento customer level,
  • it has a real commission and payout workflow,
  • it includes basic security and audit capabilities,
  • it has a modern affiliate dashboard,
  • it is ready to be expanded with additional enterprise features.

11. System requirements

The module is intended for:

  • Magento Open Source / Adobe Commerce 2.4.7+
  • PHP 8.2 / 8.3

It requires compatible Magento modules related to:

  • Customer,
  • Quote,
  • Sales,
  • SalesRule,
  • Cms,
  • Email,
  • Backend,
  • Store.

12. Implementation scope

The module can be implemented in stages:

  • start with affiliate links and commissions,
  • expand with payouts,
  • expand with affiliate coupons,
  • expand with AI and content for affiliates,
  • further expand with more advanced commission rules and fraud scoring.

This means it is suitable both for MVP implementations and for long-term development of a partner program.

13. Summary

Kowal_Affiliate is a mature affiliate module for Magento 2 that lets you sell and launch a complete partner program within your own store. It combines classic affiliate links, referral codes, discount coupons, commissions, payouts, basic fraud prevention, reporting, and a modern partner panel.

From a sales perspective, this is not just an add-on for referral links, but a complete partner layer for Magento 2 that can be offered as:

  • a standalone module,
  • an element of a store implementation,
  • part of a growth / performance package,
  • a foundation for a more advanced partner and brand ambassador program.

In practice, it is a solution that addresses the real needs of stores asking about:

  • an affiliate program in Magento 2,
  • discount codes for partners,
  • commission settlement,
  • a partner panel,
  • readiness for sales and production work.

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_Store
  • Magento_Cms
  • Magento_Customer
  • Magento_Email
  • Magento_Quote
  • Magento_Sales
  • Magento_SalesRule
  • Magento_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:

  • General
  • Commission
  • Payouts
  • Affiliate Portal
  • Notifications
  • Fraud
  • AI
  • Reporting

5. Initial configuration after installation

After activating the module, the following configuration order is recommended:

  1. enable the module globally,
  2. configure affiliate registration,
  3. configure commission and hold period,
  4. set the minimum payout threshold,
  5. complete the affiliate portal content,
  6. configure administrator notifications,
  7. optionally configure AI,
  8. 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.

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:

  • /
  • promotions
  • catalog/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:

  • 100
  • 250
  • 500

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.

Default title of the sample promotional material.

Short description under the banner title.

Default target path for affiliate links and banners.

Examples:

  • /
  • promotions/spring
  • catalog/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 Participant
  • Affiliate Status
  • Affiliate Referral Code
  • Affiliate Website URL
  • Affiliate Notes
  • Affiliate Balance
  • Affiliate Coupon Discount (%)

7.1. Affiliate Participant

Indicates whether the customer belongs to the affiliate program.

7.2. Affiliate Status

The most important statuses:

  • Pending
  • Active
  • Suspended
  • Rejected
  • Blocked

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

  1. Go to the affiliate registration form.
  2. Submit the application.
  3. Check whether the affiliate account has been created.
  4. Check whether the customer has the Pending status.
  5. Check whether notification entries have been created.

10.2. Activation test

  1. Open customer edit view in the admin panel.
  2. Set the affiliate status to Active or use the approval action.
  3. Check whether the customer can see the affiliate dashboard.

10.3. Affiliate link test

  1. Copy the affiliate link from the dashboard.
  2. Enter the store through this link.
  3. Add a product to the cart.
  4. Place an order.
  5. Check whether the order has:
    • affiliate_id
    • affiliate_referral_code
    • is_affiliate_order = 1

10.4. Affiliate coupon test

  1. Set Affiliate Coupon Discount (%) for the affiliate, for example 5.
  2. Save the customer.
  3. Make sure the affiliate has the Active status.
  4. In the cart, enter their Referral Code as a coupon.
  5. Place an order.
  6. Check:
    • whether the discount was applied,
    • whether the order was assigned to the affiliate,
    • whether a commission was created.

10.5. Payout test

  1. Approve the commission or wait for auto-approve.
  2. Check the affiliate balance.
  3. Submit a payout request.
  4. 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 = Yes
  • Enable Affiliate Registration = Yes
  • Tracking Cookie Lifetime = 30
  • Enable Commissions = Yes
  • Default Commission Rate = 10
  • Commission Hold Period = 14
  • Enable Payouts = Yes
  • Minimum Payout Amount = 100
  • Enable Notifications = Yes
  • Block Self Referral = Yes
  • Enable 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.
Release notes and change history for Kowal_Affiliate. Includes feature additions, performance improvements, bug fixes, and compatibility updates for Magento Open Source and Adobe Commerce 2.4.7+ on PHP 8.2 and 8.3.
Write Your Own Review
You're reviewing:Advanced Affiliate Module for Magento 2
Your Rating
Aktualizacja preferencji plików cookie