They wanted to allow international franchisees to use their brand name and maintain a country-specific WooCommerce platform while retaining super administrator control to access any franchisee’s WordPress dashboard when necessary.
So I was the architect to develop a solution for this requirement as I had the most experience with WordPress. At first, I was thinking of having multiple WordPress installations as sub-domains on their server, however after presenting this solution to the client, I concluded that this wouldn’t work so after researching for over a couple of weeks, I found out about WordPress multisite and the sub-domain directory approach after doing more research on that, I pitched the following architecture design which the client loved it.

The above diagram is an outline of the solution that we implemented. So the above architecture allows the current website administrators to be super administrators if they require and the sub-sites on the multisite network on WordPress will act as separate websites however, the plugins and the themes would be controlled at the multisite network dashboard on WordPress, which the Super Administrators could access. This solution was approved by the client as it was exactly what they wanted.

So I moved their website from Kinsta hosting to a VPS offered by Win Authority as that would give them more control as they would now have root access and because Kinsta hosting did not allow existing WordPress websites to be converted to a sub-directory multisite.
So I configured their server and moved their existing website to the new server, this migration took about 4 hours as their website was large, then, after confirming everything was working as expected, I went ahead and converted their website to a sub-directory multisite and again, tested if everything was working as expected.
Once everything was confirmed, I went ahead and created a new site on their multisite network (as WordPress calls it) and then selected the same theme and gave access to their franchisee. This solution worked well.
Then I wrote a JavaScript Immediately Invoked Function Expression (IIFE) to handle the country redirection based on the user’s selection. So the users would be presented with a country selection page the first time they visit the website and then this code would create a cookie and store their preference and each time they visit the website or open a link from the website it would add the country code in the URL if required. I will share the code of the IIFE soon.
Leave a Reply