Dynamic subdomains for woocommerce affiliate sales but NO multisite. Is that possible?


I’ve got a woocommerce installation that sells things. We want to offer affiliates to sell our products with their own url, ie mysite.thebasesite.com. Basically, the way that it works is that a visitor would hit the above url and I have written a plugin that extracts the “mysite” segment, does an API call to an API to get the affiliate information and then uses that information to customize some things in the header, set a cookie/session object later used to store affiliate information in the woocommerce order. All the above works when I hardcode the url segment into the plugins.

My problem is getting wordpress to maintain the subdomain in the url throughout the session. First, if I visit mysite.thebasesite.com, it immediately forwards me to thebasesite.com. Not sure why. Second, all the urls in wordpress are absolute, which I think I can get around, but still annoying. Third, all the emails from the site (particularly orders and whatnot) will have links from thebasesite.com and not mysite.thebbasesite.com. I can likely get around this too, but I’m wondering if I’m barking up the wrong tree here.

I have no aversion to using multisite but I don’t think that will work because all the content (products, themes, plugins, content) is all the same for each site AND there could be thousands of affiliates and therefor thousands of subdomains. I’m starting to think that this is just something that is going to be impossible with woocommerce and wordpress.

, , , andy 4 months 0 Answers 51 views 0

Leave an answer