WPCloudDeploy Documentation

WooCommerce & WPCloudDeploy WordPress Sites

Introduction

WPCloudDeploy allows you to sell WordPress site subscriptions using WooCommerce and WooCommerce Subscriptions.  With this feature it is now easier than ever create your own custom branded WP hosting service or create very sophisticated WAAS that can scale vertically and horizontally.

To get this done you follow a simple four-step process:

  1. Decide on which servers the sites you sell should be located
  2. Optionally create “template” sites that can form the basis of your users’ new sites
  3. Optionally setup integration with Cloudflare DNS so you can automatically setup temporary domains for your customers’ sites
  4. Create subscription products in WooCommerce that are of type “WordPress Site”

As with our feature that allows you to sell Server Subscriptions with WooCommerce, customers will be able to pay with Stripe or Paypal.  Other payment methods might work but they are not officially supported.

Pre-requisites

There are a number of pre-requisites that need to be in place before you can use this feature.  These are:

  • WooCommerce premium plugins
  • Overriding some default actions in WooCommerce
  • Adjusting some WooCommerce-related roles and capabilities

Plugins

Here are the plugins you need to make this happen (in addition to WPCloudDeploy)

Servers

  • One server on which WPCloudDeploy is installed (hopefully you already have this)
  • At least one fresh WPCD server on which your customers’ sites will reside
  • Optional – one server on which you will create and store your “template sites”

Fix WooCommerce Default Login Action

You will need a method to bypass WooCommerce’s default account page on login.  WooCommerce tends to hijack the WordPress login process and send most users to the WC account area.  But we want them to be able to go to our servers page instead.  You can override the WC default behavior using one of the following options:

  • Turn on the option we have specifically for this under SETTINGS → APP:WORDPRESS SETTINGS → WooCommerce Options.  This affects ALL WooCommerce users.  If that’s not the behavior you want you’ll need to use one of the other options below.
  • Custom code
  • Give your users a higher level default role (not recommended)

Roles and Capabilities for WooCommerce Customers

Finally, you will need to grant the CUSTOMER role the following CAPABILITIES so that they can see the WPCloudDeploy menu option in wp-admin:

  • wpcd_manage_servers
  • wpcd_manage_apps

(The CUSTOMER role is the default role that WooCommerce assigns to users who have made purchases).

You can do this with any Roles & Capabilities plugin such as User Role Editor.


Setup Servers

There are two ways to tell WPCD where your new customers’ sites should be located:

  • Select servers in the WPCLOUDDEPLOY → SETTINGS screen or
  • Specify ONE server for each product at the time you create the product.

You can also do a mix – create some products that use the servers from the WPCLOUDDEPLOY → SETTINGS screen and some that use a directed server at the time you create the product.

To select servers in the SETTINGS screen:

  • Go to WPCLOUDDEPLOY → SETTINGS → APP:WordPress Settings
  • Click on the SELL WP SITES WITH WOOCOMMERCE tab.
  • The first section of the resulting screen will be a list of your servers – just check off the ones you want to use.  (As servers fill up you can remove them and add new ones so your initial choices aren’t fixed.)
  • Click the SAVE button at the bottom of the screen.


Setup Cloudflare DNS Integration

When your customers purchase a site from you, we need to assign it a temporary domain.  You can choose to have this domain automatically set up in Cloudflare.  Here is how you do both of these things:

  1. Specify the root of your temporary domain (xxx.yyy) in the WPCLOUDDEPLOY → SETTINGS → APP:WordPress Settings → SELL WP SITES WITH WOOCOMMERCE tab.
  2. On that same screen, there is a section called AUTOMATIC DNS VIA CLOUDFLARE – fill out that form with your ZONE ID for the root domain you specified in step 1 above and your CloudFlare security token.  (Obviously Cloudflare must be the authoritative name servers for your domain).
  3. Click the SAVE button.


Configure Products

Configuring your WordPress Site products is easy – just use the standard WooCommerce Product screen.

  • Products must be of type SIMPLE SUBSCRIPTION
  • The checkbox for THIS IS A WORDPRESS SITE located under the WORDPRESS SITES tab must be turned on.
  • Click on the Inventory tab to enable stock management – turn on the option for Sold Individually.
  • In most cases you would want to check the VIRTUAL option as well since it’s not something that is being shipped.


Remove Ajax Buttons

If you’ll be using the WC product archive pages, you must remove the AJAX buttons because they bypass the product detail page.  The product detail page is where the customer choose their site options.

One way to disable these buttons is via CSS such as the following (your theme might have slightly different classes):

.archive .add_to_cart_button {
display: none; !important
}

Template Sites

Template sites allow you to create sites to use as the baseline for new sites.  So, when your customer purchases a site product from your WooCommerce store they can start with the template you specify.

Template sites must be placed on their own server – they cannot be on the same server where your customer sites are being deployed.

This means that to use template sites you need a minimum of two servers – one for the template sites and one for your customer sites (plus a third server for your WPCD site).

You can designate any site as a template site on any server – as long as it’s not on the same server as where your customers’ new site(s) will be deployed.

To designate a site as a template site just use the checkbox in the SITE DETAILS screen:


Advanced Features


The WooCommerce integration module includes a number of additional features not discussed above.  These include:

  • Cancellation options – lock or disable sites
  • Options for handling sites when subscriptions are placed on hold
  • Subscription switching
  • Suppressing certain emails
  • Custom emails per product

Learn more about these features in our WPCD WooCommerce 3.0 document.


About The Number Of Sites Field

When defining a product you have the option to indicate how many sites a subscription is for.

This is a very simplistic control and has some very SEVERE limitations that you must be aware of.  

The first limitation is the process by which the user can create a new site.  Generally, we designed this entire SELL SUBSCRIPTIONS WITH WOOCOMMERCE module around the idea that one site is one subscription.  Because of this, the user cannot use the normal WPCD ADD NEW SITE button.  Instead a user will only be able to create a new site only by cloning their existing site.

The second limitation is that we’ll make a good faith attempt to aggregate the number of sites that a user has purchased by increasing and decreasing a counter in the user profile.  In other words, if a user purchases another subscription we will increase the count in the user profile.  If they delete a site, we will decrease the count.

But, because we are NOT tracking the count by subscription, whenever the user cancels a subscription, the entire count is reset.  Which means that the user will not be able to clone new sites until the admin manually updates the count.

If a user exceeds their allowed sites, the CLONE SITE screen will simply show a message but the CLONE SITE tab will remain enabled.

There are certain instances where we bypass this check though:

  • If the user is an WPCD Admin
  • If the user has the rights to view the server on which the site is installed (this accounts for the situation where the user might purchase both a server subscription as well as some individual site subscriptions).

Sites that are classified as staging sites are NOT included in the site count limit.

We do eventually plan to allow multiple sites per subscription and track strict limits by subscription.  BUT, that is a very low priority development item since most of the use cases we have encountered so far have been one site per subscription.  If you have an immediate need for multiple sites per subscription with multiple subscriptions per user tracked properly, we’re happy to consider a custom project to implement it for you.


Filter Hooks

apply_filters( "wpcd_wpapp_wc_validate_domain_on_checkout", true, $domain, $domain_root )

Use this filter to validate the domain.  For example you can use it to check that it does not include rude words in your language.  Return false to stop the checkout process or true to allow checkout to continue.

This hook only apply after it passes all our validations. You cannot use it to override our internal validations. You can use it only to layer in your own additional validations.

apply_filters( "wpcd_wpapp_wc_validate_password_on_checkout", true, $pw )

Use this filter to validate the password.  For example you can use it to check that it contains a minimum number of characters.  Return false to stop the checkout process or true to allow checkout to continue.

This hook only apply after it passes all our validations. You cannot use it to override our own validations. You can use it only to layer in your own additional validations.

Note: these hooks are only available in our WooCommerce V3 plugin and are valid only in combination with WPCD 5.0 or later.


Important Notes & Limitations

Configuring Target Servers

We strongly recommend that each of your target servers install the SMTP gateway. Otherwise your users will not be able to get a password reset email to log into their new sites.  A side effect of this though is that a malicious user can use their WordPress site to send out spam emails which will cause the servers’ ip address to be blacklisted.  So definitely make an effort to know your customer.

An alternative to this is to send your customers their passwords in the confirmation email – less secure but it might not matter if you are creating relatively simple sites.

Some Limitations

This function is not designed for you to sell dozens of WordPress subscriptions an hour.  We have not tested it with more than a few sites every hour.  So officially, we are stating that it will not work well if you’re provisioning more than one site every 10 minutes on the same target server.  (Though, while we suspect that you can do more than that, we just don’t want you trying to sell 100 sites every 10 minutes).

We do have a higher priced solution suitable for high volume agencies  So, if you need high-volume provisioning please contact us and we’ll provide a quote to get this up and running for you.

Canceling Multiple Subscriptions

WooCommerce allows you to cancel multiple subscriptions at a time from its subscriptions list.  However, keep in mind that each subscription has to then reach out to the WordPress servers and remove the associated sites.  So it’s best to bulk cancel only 4 or less at a time.  Otherwise, the PHP script will timeout and things will be left in an unknown state.

Delete Protection Limitations

Sites have a flag that allow users and admins to remove the DELETE option from the screen.  This prevents accidental deletion of the site from the UI.  However, when a subscription is canceled the associated site is deleted regardless of this value.

Add-To-Cart & Checkout Notes

You must LIMIT the number of sites that can be ordered at the same time to ONE. We have attempted to do that for you but you can ensure that this limitation is adhered to by doing the following when setting up your product:

  • Click on the Inventory tab to enable stock management – turn on the option for Sold Individually.

Using Template Sites

AWS EC2, LightSail, Azure, Alibaba & GCP servers cannot be used when using Template Sites.  In other words, you should not set up a product where the destination server is located at one of these providers AND there is a template site that needs to be used for the new site.  However, you can still use these providers for sites without templates.

The reason that this is a limitation is because we need full ‘root’ access to set up the processes on both servers that make copying sites efficient.  So any server that does not use ‘root’ as the login cannot be used for template or target sites.

Bulk Actions In The WC Subscriptions List

Most BULK actions will not properly handle cancelling sites.  The only ones that will properly delete is CANCEL.  Others such as “Move To Trash” will not do it.

And, “ACTIVATE” will not create a new site!  So if a subscription was put on hold or somehow did not complete properly during initial checkout, the ACTIVATE function will not create the new site!

In General, be careful using WooCommerce BULK ACTIONS with subscriptions and orders that involve WPCD related functionality.


FAQ: Template Sites VS WPUltimo

Before this product has even been released we have had discussions with users where this question was raised – in fact it was the number one question for this feature.  So we’re going to address it here in the documentation (and possibly elsewhere on our site) in as much gory detail as we can muster.

Selling WP Site Subscriptions With WooCommerce is a much different experience than WPUltimo.  WPUltimo will be far easier to get started with and can be used with most hosts.  WPCD’s Selling WP Site Subscriptions With WooCommerce can only be done by managing your own servers with the WPCD Plugin.  And it requires a higher level of skill to get started.

From a cost standpoint, you can get started with WPUltimo for under $500 dollars including hosting.  With WPCD, you’ll need the $999 plan plus three small cloud servers plus WooCommerce and WooCommerce subscriptions. And you will need some sort of  dedicated central site management tool such as MainWP or ManageWP.  So you’ll be out over $1300 before you even bring up your first site.

From a skills standpoint you can use WPUltimo with beginner WP skills.  You cannot do that with WPCD.  In fact, WPCD is targeted at users with at least 1 year of solid WP experience who are looking to level up their skills – and their WP hosting options.

With WPUltimo you can go to almost any WordPress hosting company, install it and get started with it in about 30 minutes.

With WPCD you have to:

  • Install it on a server
  • Install WooCommerce
  • Install WooCommerce subscriptions
  • Generate SSH keys
  • Connect to a cloud server provider
  • Fire up a couple of cloud servers

All before you can create your first product.

Finally, WPUltimo has some features that we will find hard to provide “out-of-the-box” in a distributed deployment.  For example, locking down different plans based on the number of entries in a custom post type, default pricing tables, limiting plans by disk usage, limiting plugins and themes to certain plans, implementing site quotas and increasing them automatically as users upgrade to new plans etc.  These are features you’ll need to implement in your template sites using other plugins or custom plugins.

After reading all that, you are probably thinking “What the heck?  Are they trying to turn me off of WPCD and go to WPUltimo?”

No, not at all.  There is definitely overlap between our  WooCommerce feature and WPUltimo.  But only in some areas.   In other areas, WPCD is a far more expansive and ambitious product than WPUltimo.

While you pay a higher price in both dollars and skills with WPCD you get a LOT in return!  Some benefits are:

  • You can scale your WaaS horizontally and vertically.
  • Your WaaS project can use many more plugins – many of which will not run on a Multisite.  In particular you can now build out WaaS services that use WooCommerce.
  • By distributing your WaaS sites across many servers and server providers you can prevent all your customers from suffering from an outage at the same time – no more risking 50+ irate customers because you made a mistake on your WP Multisite install.
  • You can do rolling updates – testing new features on some customers first to make sure there are no side-effects before rolling them out to your entire customer base.
  • You can easily increase resources for those customers who need it without having to scale for ALL your customers at the same time – not all customers are created the same!
  • You can use plugins that are problematic on Multisite such as WooCommerce.
  • If you service customers from around the world you can choose servers closest to their geographic region which can make their sites feel faster for their customers.
  • You can offer customers additional purchase options for using plugins that might not have been possible on a dedicated Multisite installation.
  • If you are unfortunate enough to suffer a malware infection, it will likely affect only the few customers on a server rather than all your customers the way it would on a Multisite installation.
  • You can use WP Site management panels such as MAINWP and MANAGEWP to managed your sites at scale.  These panels do not officially support Multisite installations of WP.

I think you get the point.  You pay a higher price for a LOT of benefits.  But you do have to forego some of the WPUltimo conveniences.

So, you just have to decide what’s important to you and how you prefer to work.  Neither option is the “best” for everyone.  And we don’t view ourselves as WPUltimo competitors – in fact we use them for some of our own projects!  And, if you want, I suspect you can find a way to sell WPULTIMO multi-sites on WPCD!  Now ain’t that something?


Related Articles

What’s New In WPCD WooCommerce 3.0

Sell Site Subscriptions With WooCommerce V1.5


Related Sites

opensaas.io


 

Share: