Adding WooCommerce (Varnish) support to an existing wordpress site


#1

I’ve been running my site with a different shopping cart.
I am changing my shopping cart to WooCommerce.

What modifications can I make to my existing site/server/app to make it compatible for WooCommerce?
It is my understanding that the difficulty with adding WooCommerce to a Cloudways server, has to do with Varnish support/conflicts.

Additional Information:
My site structure does not enable me to use Cloudway’s site import tool - It Failed Miserably when I attempted to migrate my site to Cloudways via this tool !! NP - I was not surprised.
Also, when I chose “Wordpress” for my server, I actually had to delete installed files on the server and start over, because it did not conform to the way my site is setup.
I mention this to avoid responses that would rely on one of the above methods.

Preferably, if there are some settings that I can change, or a file to upload, or a list of URL’s to exclude from Varnish, etc… - that is ideally what I am looking for.
Any easy, foolproof way, however, that does NOT require me to change the structure of my site is Welcome. :slight_smile:

Thanks :sunny:


Announcing the Top Users for the month of December (2017)
#2

Hi @sheryl

Yes, you can convert your WordPress install to WooCommerce by excluding URLs from Varnish settings which contain the following strings:

/cart
/my-account
/checkout
/addons
?add-to-cart=
/add-to-cart

You also need to exclude any cookie from Varnish settings if it is being set by the application while performing any Cart operation.

Please let us know if you face any issues.

Haider


#4

Can you please verify that “?add-to-cart=” expression is correct? Is there anything else missing?
What about the woocommerce default cookies? Can you please share what to exclude?

Thanks


#5

Hi @fatal.error.gr

Here are the default WooCommerce cookies need to be excluded from Varnish.

woocommerce_cart_hash
woocommerce_items_in_cart
wp_woocommerce_session_

#6

Am I missing anything? :slight_smile: Please let me know. Thanks


#7

Hi @fatal.error.gr , why you not make url like this “/cart/” or “/checkout/” ?

also you should input “/?add-to-cart=” not “?add-to-cart=”

see here: https://support.cloudways.com/how-to-exclude-url-from-varnish/


#8

@fatal.error.gr

Please make sure the URLs end with a trailing slash “/” or without it. Normally, the URLs end with a trailing slash like “/cart/”, “/checkout/” etc.

I would suggest to visit URLs individually and see if they end with / and then update rules accordingly. Once updated, don’t forget to purge Varnish.


#9

Sorry guys, this guide is confusing me. Why there is need to install Multisite?

I need just WordPress + WooCommerce + Varnish only


#10

Yeah, it would be nice to have some Knowledge Base article from the Cloudways Support to make existing wordpress installations are Varnish-friendly for Woocommerce sites, or some other way to convert a simple Wordpress install to a Woocommerce install to take care of those settings.
I’ve contacted support, but as usual for cloudways support, they couldn’t give me a list of exclusions that has to be applied to varnish settings in this case.


#11

Correct me if I am wrong, but I think you can create a new WP WC installation. Then use site migrator tool from old WC site to new WC site and the “special settings” will be in place?