Do you want to create a WooCommerce multisite? If Yes, then this article is good for you. In this article, I am going to tell how to create a Varnish-enabled WooCommerce store on WordPress multisite.
WooCommerce Multisite Store
What is WooCommerce Multisite?
WooCommerce 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.
Does WooCommerce Work on WordPress Multisite?
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 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 setup WooCommerce store.
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. */
/* Multisite */ define( 'WP_ALLOW_MULTISITE', true );
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.
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 Multisite Shops Now!
With Cloudways, setting up a Varnish enabled multisite WooCommerce store on a WordPress 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.
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 email@example.com
Be the first to check out WordPress 5.0
Use our Staging feature before upgrading your website to WordPress 5.0.