How to Create a Varnish Enabled WooCommerce Store on WordPress Multisite

by Mustaasam Saleem  March 6, 2018

WordPress Multisite refers to a network of WordPress websites, where an administrator controls all the sites within the network. Many people consider an ecommerce store using WordPress and WooCommerce.

One of the best ways of speeding up a WordPress site is to add Varnish to the mix. In this article, I will show you how to create a Varnish enabled WooCommerce store on WordPress Multisite network.

varnish on wordpress multisite woocommerce store

Varnish is used to cache all the content of a WordPress site to reduce server load time. However, when Varnish is used with WooCommerce, several pages of the store usually do not work well. An example of such pages is the cart that is always dynamically generated. Thus, cart and checkout pages could not (and should not) be cached.

Cloudways has come up with a solution to use Varnish in WordPress Multisite stores by excluding URLs that do not work properly.

Install WooCommerce on Cloud

First of all, you need to create a Varnish enabled WooCommerce store, so that, you can enable WordPress Multisite on it. Cloudways offers 1-click WooCommerce hosting. This detailed guide illustrates how to install WooCommerce.

Once you have set up pre-configured Varnish enabled WooCommerce store, the next step is to enable WordPress Multisite on it.

Enable WordPress Multisite on WooCommerce

Go to Cloudways platform, and navigate to Server from the top-left menu bar. Get into the server (where WooCommerce is installed). Use Master Credentials to connect with an FTP client like FileZilla, don’t forget to use port 22. Once connected, go inside the installation folder so that you could edit the files.

Open wp-config.php and write below lines of code, just above where is says /* That’s all, stop editing! Happy blogging. */

Save it and then re-login to the WordPress admin dashboard.

Navigate to Tools -> Network Setup. It will ask you to deactivate all plugins. Deactivate them, and you will be asked to create a network of subdomains or subdirectories. In this case, I will opt for subdirectories.


Next, WordPress will ask you to modify wp-config.php and WordPress .htaccess file located in the root directory of the application. Modify them as per the requirements below.


Once done with editing files, log in to the WordPress Dashboard again and you will see the Network Dashboard from where all of the websites could be controlled.


Go to Sites -> Add New and fill in the fields:

  • Site Address: This is the subdirectory as well as the main URL of store.
  • Site Title: The title of store.
  • Admin Email: The email address of the administrator.

I now assume that you have created a store and named it “Store 1“.


Install WooCommerce on WordPress Multisite

From the WordPress admin (Network), navigate to Plugins and enable WooCommerce by clicking on Network Activate. WooCommerce is now available throughout the network.

Now, login to the admin panel of Store1 with credentials you received on the administrator email provided at the time of setup. As you can see from the new tab in the left pane, WooCommerce is now available at this store. Run the Setup Wizard and follow on-screen instructions to configure WooCommerce on WordPress Multisite.


After setting up your store, try to add a few products and make a purchase. Your cart will look like something below.


After the cart, you will see the following checkout page.


When you are done with order placement, go back to the cart page, and you will find that the cart is empty.


As mentioned in the introduction of this article, Varnish caches all content of a website, including the cart and checkout pages. Thanks to pre-configured Varnish rules on Cloudways’ WooCommerce hosting setup. Otherwise, you may need to exclude URLs from Varnish settings.

Build Your WooCommerce Shops Now!

With Cloudways, setting up a Varnish enabled WooCommerce store on a WordPress Multisite is a walk in the park. All the Varnish rules are pre-configured on Cloudways, however, if you find any URL not working properly with Varnish, you just need to exclude those URLs from Varnish rule. If you have any query or suggestion, feel free to ask using the comment section below.

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Mustaasam Saleem

Mustaasam is the WordPress Community Manager at Cloudways – A Managed WordPress Hosting Platform, where he actively works and loves sharing his knowledge with the WordPress Community. When he is not working, you can find him playing squash with his friends, or defending in Football, and listening to music. You can email him at

Stay Connected:

You Might Also Like...

  • Pets na Web (Adm Pets na Web)


    Thanks for this article!
    I have a WordPress multisite with Woocommerce and W3 Total Cache on cloudways.
    When I created my application I chose the option of Woocommerce Application in Cloudways. I did this because I read this article:

    In the above article cloudways informs you that the woocommerce application type in cloudways automatically deletes the important pages of woocommerce, such as the shopping cart for example.

    In this article you are asking to create the application by choosing the Multi Site option from cloudways. Then you are prompted to manually delete the pages in the cloudways panel settings.

    I have doubts now:
    1) What is the best option for WordPress multisite with woocommerce on cloudways? Is the type of WordPress multisite cloudways application or the Woocommerce application type of cloudways?

    2) In my multisite network I work with subdomain and with mapped domains. In this case how should you configure the deletion of the woocommerce pages in the cloudways dashboard? Can you give me examples?


    • Hello @petsnawebadmpetsnaweb:disqus
      Yes – you are right, our WooCommerce automatically excludes URLs from cache and you can also create a multisite network on it. There are two ways to use WooCommerce on Multisite.
      1 – Multisite in WooCommerce (You are here)
      2 – WooCommerce on Multiste (This article)
      Both will work well.

      In WooCommerce application, you can’t modify pre-defined rules. But, by installing Multisite first, then WooCommerce. You can do few additional configurations.
      Let’s suppose, on your WooCommerce application. The account page is excluded from Varnish. But you want to allow Varnish to cache this page, this will be done by following this article.

      Regarding sub-domains, it will work like below. – This will exclude all URLs that lies under “cart/”.
      In the same way, you can exclude more sub-domains.

      To know more about rules, you can read from the link below:

      If you still have any query. Feel free to ask. I would love to help.

  • Ega Adrian

    Hello @mustaasamsaleem:disqus

    I’ve read and tried it in my server here’s attached the rule I’ve set.
    But after set those rules, I still cant get my guest add-to-cart to work

    • Hello @egaadrian:disqus
      The attachment is missing. Can you please re-upload?
      One more thing to notice, have you set the price for products?