Flash sale: Get up to 30% off themes and extensions. Ends April 26 at 3 pm UTC. Shop the sale.
  1. Documentation /
  2. Affiliate For WooCommerce /
  3. How to override templates

How to override templates

Affiliate for WooCommerce plugin helps you to add, manage affiliates, and track performance from a single place – commissions, sales, payouts, leaderboard, etc. Earn money without hard work. Increase your brand outreach, and get potential customers.

This doc explains different templates the plugin has and how you can override them.

All templates are located in the ‘templates’ directory of Affiliate for WooCommerce – /affiliate-for-woocommerce/templates/ and are overridable.

If you want to change or modify the content or layout of a template, you can do it by using the ‘another template file’ method explained below.

Notes

1. We recommend using the child theme if you are overriding the templates as explained above. Read more here: Set up and use a child theme.
2. The above method is considered customization. We are happy to provide guidance, but we are unable to provide support or help to suit your store. Only use it if you are comfortable with PHP and custom coding and troubleshooting on your own.

Override via another template file (Upgrade-safe)

↑ Back to top

Use your own template in place of the default one provided by Affiliate for WooCommerce. Copy the template into a directory named ‘woocommerce’ within your theme keeping the same file structure but removing the ‘templates’ subdirectory.

Consider you want to override the email sent to affiliates when they join your affiliate program (Welcome email). Follow these steps to override that template:

  1. Create a template file and keep the file name as: afwc-welcome-affiliate-email.php. Other file names will not work.
  2. Open your themes folder and check if you have a folder named woocommerce. If not, create a folder named woocommerce
  3. Open woocommerce folder and create a new folder inside it. Keep that folder’s name as: affiliate-for-woocommerce
  4. Place the file afwc-welcome-affiliate-email.php inside affiliate-for-woocommerce
    For example: To override the email template of the affiliate welcome email,
    copy: wp-content/plugins/affiliate-for-woocommerce/templates/afwc-welcome-affiliate-email.php
    to wp-content/themes/yourtheme/woocommerce/affiliate-for-woocommerce/afwc-welcome-affiliate-email.php

The copied file will now override the default welcome email and the plugin will use your template file (if found).

Override emails

↑ Back to top

This section explains the emails the plugin sends to affiliates and affiliate manager/store admin and how you can override the email templates.

You can follow the above method to override these email templates of the Affiliate for WooCommerce plugin:

  1. afwc-affiliate-pending-request.php – Email is sent to the affiliate after the registration form is submitted and their request to join the affiliate program is in pending status.
  2. afwc-new-registration-received.php – Email is sent to the affiliate manager/store admin when someone joins your affiliate program.
  3. afwc-welcome-email.php – Email is sent to the affiliate when they join your affiliate program via the registration form.
  4. afwc-commission-paid.php – Email is sent to the affiliate when commission is paid on their referral orders.
  5. afwc-new-conversion.php – Email is sent to the affiliate when a new order is placed using their referral link/coupon.

Override affiliate’s account tabs

↑ Back to top

This section explains how you can override tabs from affiliates’ account.

Reports tab

To override the reports tab from the affiliate’s account,
copy: /wp-content/plugins/affiliate-for-woocommerce/templates/my-account/affiliate-reports.php
to: /wp-content/themes/yourtheme/woocommerce/affiliate-for-woocommerce/my-account/affiliate-reports.php

The copied file will now override the My Account > Affiliate > Reports tab and the plugin will use your template file (if found).

Profile tab

To override the profile tab from the affiliate’s account,
copy: /wp-content/plugins/affiliate-for-woocommerce/templates/my-account/affiliate-profile.php
to: /wp-content/themes/yourtheme/woocommerce/affiliate-for-woocommerce/my-account/affiliate-profile.php

The copied file will now override the My Account > Affiliate > Profile tab and the plugin will use your template file (if found).

Feature request

↑ Back to top

Have a feature request or enhancement suggestion for Affiliate For WooCommerce? Submit it from here: Submit a feature request.