Home Opencart How does Affiliate work in Opencart 3?

How does Affiliate work in Opencart 3?

An affiliate program is a marketing strategy to increase sales by increasing the partner who will sell our products for some commission. In Opencart 3 we will show how affiliate works. We dd the customer as an affiliate, in Opencart 2 affiliate needs to be registered separately.

The whole flow of the affiliate is shown in the following image:

Affiliate flow chart

How does the affiliate is registered in Opencart 3?

The Affiliate link is in the footer of the extra column in the default Opencart theme. The link to register is like https://YOURURL/index.php?route=affiliate/login, then the visitors of the website can register for the Affiliate program which will become a customer as well. They will get an email with the tracking code.

The customer can also register for the Affiliate from the Customer Dashboard.

How to activate the affiliate for the already registered customers?

Go to Admin >> Customers >> Customers >> Edit the customer whom you want to make affiliate >> Click on Affiliate tab and enter the details and choose Status to enabled:

Save it and the customer became an affiliate. Sometimes approval is needed if the setting “Affiliate Required Approval” is enabled at admin >> System >> Settings >> Edit your store >> In the Options tab there is Affiliates section where there are multiple options to select for the affiliates as shown in the image below:

How does the affiliate use the URL on their websites or blogs or forums?

Login to the frontend as customer or affiliate then go to the “My Account” and click “Custom Affiliate Tracking Code“, you will see the tracking code, tracking link generator and tracking link.

Don’t change the tracking code as this is unique for you and if you change then old URL will not work. Then in the tracking link generator enter the product name that you want to link, it will autocomplete your product, select it and the Tracking link is showing which is the link that you will use in the websites or blogs or forums.

Your tracking link is http://YOURURL/index.php?route=product/product&product_id=42&tracking=YOURTRACKINGCODE, if you want to redirect to the home page of the website then it will be like http://opencart.loc/index.php?tracking=YOURTRACKINGCODE. The Opencart will set the cookie “tracking” with your tracking code for 1000 days.

If you want to change those days then go to catalog >> controller >> startup >> startup.php and find following code

// Tracking Code
if (isset($this->request->get['tracking'])) {
    setcookie('tracking', $this->request->get['tracking'], time() + 3600 * 24 * 1000, '/');
    $this->db->query("UPDATE `" . DB_PREFIX . "marketing` SET clicks = (clicks + 1) WHERE code = '" . $this->db->escape($this->request->get['tracking']) . "'");

Now change the setcookie(‘tracking’, $this->request->get[‘tracking’], time() + 3600 * 24 * 1000, ‘/’); time to your preferred seconds. It should be in seconds like if you want to set cookie only for 60 days then it will be time() + 3600 * 24 * 60 and so on.

How the commission is added to the affiliate?

When someone clicks the affiliates tracking link and reach the website then the cookie is set, once the order is complete then the Affiliate amount is shown in the Admin >> Sales >> Orders like in the image below:

Now the affiliate will see the commission amount at their dashboard >> My Orders >> Your Transactions and they will see the amount there:

The current balance can be used as Store Credit to buy the products in the store. It will be like below:

We didn’t find the way to request a check or request to send in Paypal although Opencart had the option, we hope this will be a manual process, for now, just contact the store owner once you have some balance.

We hope this opencart tutorial helps you understand the affiliate flow of Opencart 3. Let us know if you have any questions or suggestions, please subscribe to our YouTube Channel for Opencart video tutorials. You can also find us on Twitter and Facebook.


  1. hello sir
    this article is very helpful and thanks for creating it but please after enabling affiliate in my opencart store, on the checkout page, it is showing error that “undefined index: affiliate_id” and for that reason, the checkout page is not working anymore.
    i hope this message reach you well and you help me solve this



Please enter your comment!
Please enter your name here

Exit mobile version