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 Affiliate for WooCommerce default email template file for the welcome email.

Affiliate for WooCommerce plugin will use your template file (if found) for the Welcome email sent.

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-welcome-email.php – Email is sent to the affiliate when they join your affiliate program via the registration form.
  2. afwc-commission-paid.php – Email is sent to the affiliate when commission is paid on their referral orders.
  3. afwc-new-conversion.php – Email is sent to the affiliate when a new order is placed using their referral link/coupon.
  4. afwc-new-registration-received.php – Email is sent to the affiliate manager/store admin when someone joins your affiliate program.

Override affiliate account

↑ Back to top

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

To override the profile tab of the affiliate’s my 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.

WooCommerce

The most customizable eCommerce platform for building your online business.

  • 30-day money-back guarantee
  • Support teams across the world
  • Safe and secure online payment