Will AffiliateWP work on a Multisite Installation?
Absolutely! AffiliateWP can be set up so that all sites on the network share the same affiliate data.
- Set up a WordPress Multisite.
- Add the constant below to your wp-config.php file. A good place would be where you were instructed earlier in the multisite installation, just above the /* That's all, stop editing! Happy blogging. */ line:
define( 'AFFILIATE_WP_NETWORK_WIDE', true );
- Navigate to My Sites → Network Admin → Plugins and click Network Activate under the AffiliateWP plugin name. AffiliateWP will now be network activated, and will appear in each sub-site's WP admin interface.
Since AffiliateWP shares its database tables across all sites on the network there's a few things to note:
- Whenever a visit is created on any sub-site, it will show on the Affiliates → Visits page of all sites on the network.
- Whenever a referral is created on any sub-site, it will be shown on the Affiliates → Referrals page of all sites on the network.
- Whenever an affiliate registers on any sub-site, they are an affiliate on all sites. They can then append their referral ID or username to any other sub-site URL and earn a commission if the customer purchases.
- An affiliate has an affiliate area on all sub-sites.
- Creatives are shared across all sub-sites.
- Settings are individual to each sub-site and not shared between them, since these are saved in the wp_options table. This means that each sub-site can have different settings. Don't forget to enable your chosen integration on each sub-site to generate referrals for that site.
If a customer clicks on an affiliate's referral link and then visits a different sub-site on the network and then purchases, does the original affiliate earn commission?
Yes, but if your multisite network is set up to use sub-domains (instead of sub-directories), you'll need to enable the Cookie Sharing setting on the Affiliates → Settings → General page.
What license do I need to use WordPress Multisite?
You'll need to allow for an activation of the core AffiliateWP plugin on each subsite that you wish to use AffiliateWP on, even if it is Network Activated. You can see the activation options on our pricing page: https://affiliatewp.com/pricing/
Is there a way to configure the license key with wp-config.php for multisite?
Yes! Simply add the AFFILIATEWP_LICENSE_KEY constant to your wp-config.php file and it will be pre-populated on each sub-site, ready to be activated:
define( 'AFFILIATEWP_LICENSE_KEY', 'YOUR KEY HERE' );
What if I'm moving an existing, standalone AffiliateWP site into a multisite sub-site? Can I retain all of my affiliates and activity to share across all sub-sites on the network?
Yes, you can with a few extra steps if you are comfortable removing and renaming tables in your site's MySQL database.
When AffiliateWP is on a single, standalone site it creates a site-specific database. When you move it to a network installation, new network-wide tables are created to be shared across all sub-sites when AFFILIATE_WP_NETWORK_WIDE is set to true (as seen above in Step 2). The tables it creates are prefixed with affiliate_wp* and are empty.
To correct this:
1. Delete the empty tables.
2. Re-name the old tables belonging to the previously standalone site to begin with the same prefix of affiliate_wp*. Refresh, and now you can see all affiliate data from any sub-site on the network.