news icon

WooCommerce and cache – Part 2: new Cache Handler plugin

Read Part 1: WooCommerce Currency Switcher and cache – Making them work together

Some months ago, we wrote about one of the most common issues faced by merchants who run highly dynamic websites, which include multi-currency, multi-pricing, geolocation features: stale content served by rigid caching systems.

In brief, there are quite a few caching systems designed with the assumption that the content of a site is the same for anyone. No matter who is opening a page, they serve the same information. This is correct for relatively static sites, such as blogs, which show the same articles to every member of the audience, or simple e-shops, where the prices are set, and are the same for every customer.

In a few words, many caching systems assume that, given a page on a site, the content of such page will always be the same, without exception. As we explained, this is incorrect when a site is highly dynamic. A shop that handles multiple currencies may be showing different prices to different visitors, or it might need to show a different tax rate (this is actually a requirement in many countries), on the exact same page.

With a static caching system, the result is that users may end up seeing the wrong content. This makes for a worse user experience, and can have an impact on conversion.

After an in-depth analysis, and several experiments, we came to a conclusion: issues caused by the caching system must be solved by the caching system. Based on this approach, we prepared an algorithm for dynamic caching that handles the needs of a multi-currency, multi-pricing, multi-language shop as it should, without compromising on the performance. This, in our opinion, is the correct way to address the issue.

The status of Dynamic Caching today

We keep contacting as many hosting providers as possible, explaining them how they should update their caching systems to bring them up to speed. Our objective is to make it clear that handling highly dynamic caching is a must, not just a “frill”.

Quite a few providers agreed with our approach, and allow their customers to customise the caching logic as required. Others, like the WP Engine team, showed interest in our solution, and are currently reviewing it, for future implementation. There are some who are still “lagging behind”, and there are a few, such as CloudFlare, who only offer dynamic caching on their most expensive plans.

Due to these limitations, imposed by an obsolete architecture, merchants have make a difficult decision:

  • Change hosting/service provider and move to one that handles caching as it should. This would make sense, but it’s not always possible. Besides, merchants might have invested a significant sum in current service.
  • Disable the caching system they are using, and for which they might have been paying a service fee.
  • Abandon the idea of a multi-currency, multi-language site, potentially risking to drive away audience.

While we still maintain that caching issues must be addressed on the caching layer, we wanted to find a solution that would help merchants, at least temporarily, while the service providers update their system.

Welcome our new plugin: WooCommerce Cache Handler

Thanks to our customers’ support, we are happy to announce the release of the WooCommerce Cache Handler plugin (currently in Beta stage). This new plugin can be used as a workaround with rigid caching systems, such as CloudFlare, SiteGround “Dynamic” Cache (which is actually static), as well as plugins that don’t support dynamic caching, such as W3 Total Cache.

Please note that our recommendation is still to consider switching to a more flexible solution, but this plugin will cover you until you are ready for that change.

How it works

The WooCommerce Cache Handler is simple to use. All you have to do after installing the plugin is go to WooCommerce Settings > Cache Handler and choose the handler you prefer.

WooCommerce Cache Handler - Configuration page

Configuring WooCommerce Cache Handler is extremely easy. Simply choose your favourite handler, clear the cache, and you are ready to go!

After that simple selection, the Cache Handler will support our Currency Switcher, Prices by Country, Tax Display by Country, and all our other WooCommerce plugins.

Currently, there are three options available.

1. Disabled

As the name implies, this disable all the features of the plugin. It can be useful for testing.

2. Redirect

This option is an almost exact equivalent of the “caching support” feature implemented by WooCommerce, which is enabled when the Default Customer Address is set to Geolocate (with page caching support).

The major difference from the standard feature is that our handler takes into account details such as the currency, customer’s country, customer’s state, customer’s tax exemption, and so on, ensuring that the correct content is served to customers based on these parameters. Like the original workaround from which it was derived, this handler appends a random string to URLs.

Benefits and drawbacks

+ The Redirect handler is based on the original workaround implemented by WooCommerce.
+ This solution works on a page level, thus it can produce the correct content with any configuration, or 3rd party plugins.
– The URLs look “ugly”, due to the string appended to them to work around the limitations of caching.

3. Ajax Loader

The Ajax Loader is an alternative to the Redirect, and it’s more elegant, as it doesn’t alter page URLs with ugly, random text. This handler loads all pricing elements via Ajax, when the page load is completed. The result is the following:

  1. A visitor connects to your site from the US. He would like to see USD.
  2. The rigid caching system has the page cached in EUR, and serves it to the customer.
  3. The Ajax Loader kicks in as soon as the page is loaded, requesting the updated prices from the server. After a brief moment, all elements that were displayed in EUR are changed to USD, as the visitor would expect.This update is very quick, and, at the moment, it processes the following standard elements :
    – Product prices
    – Currency selectors
    – Price filter widget
    – Custom prices displayed with the Currency Switcher shortcodes.

Benefits and drawbacks

+ The Ajax Loader is a more elegant solution than reloading the page after appending a random string to the URL.
+ Page load is faster, as there is no redirect.
+ URLs are not altered. There is no random text appended to them.
– The Ajax Loader can only process standard elements on the page. If 3rd party plugins add their own pricing elements, such addon prices, custom totals, etc, those won’t be updated. It will be up to the 3rd party plugins’ authors to “hook” into the Ajax Loader and refresh their elements via Ajax.

How to get the WooCommerce Cache Handler

The WooCommerce Cache Handler is available free of charge. Please feel free to download and try it, and see how it works for you. Whether you are using CloudFlare, SiteGround, WP Engine, Flywheel, or any other service with static caching, the Cache Handler got you covered!

Questions? Feedback?

The Cache Handler is still in Beta stage and that, as any free plugin, it’s not covered our free support. We would recommend to try it on a staging copy of your site, so that the live site won’t not affected by bugs that we eventually have to address.

We also would like to encourage you to share your feedback by contacting us. If you wish to contribute to the development of this plugin, you are more than welcome to do so!

Thanks for reading, and see you soon on aelia.co!

The Aelia Team

news icon

WooCommerce Currency Switcher and cache – Making them work together

This article continues in WooCommerce and cache – Part 2: new Cache Handler plugin

One of the most common questions we receive from our customers is how to make a highly dynamic, multi-currency, multi-pricing, geolocation-enabled sites work properly with caching enabled. This is not always an easy task, because caching systems are designed with the assumption that the content served by a site doesn’t change depending on the visitor. Such assumption holds true in many cases, as a large number of sites does indeed serve the same content to whoever views a page. In such case, the standard behaviour of caching systems, which is storing one copy of each page in the cache, is acceptable.

As soon as multi-currency features are added, the same behaviour proves itself too limited, because the assumption behind it becomes incorrect. A multi-currency shop serves different content to different visitors, depending on the currency and other criteria (applicable taxes, regional pricing, etc). Quite simply, having one cached copy of each page just doesn’t cut it anymore.

Until recently, the only way to prevent caching from interfering with the multi-currency features was to disable it on catalogue pages. Doing so ensures that the shop can produce content dynamically, showing the correct information to each visitor. In some cases, when the caching system in use is too rigid, this is still the only solution.

How WooCommerce handles the issue

WooCommerce itself has to deal with caching since its team introduced geolocation features in it. The WC team added a workaround to “trick” caching systems into letting WooCommerce serve the correct data. Such workaround works by reloading the shop pages in a way that cache is ignored. This ensures that the page shows the correct content but, in our opinion, it’s not an ideal approach. We certainly appreciate the effort put into it, and the fact that there isn’t much more that a plugin can do to correct the behaviour of the caching system. However, we decided to find an alternative, more robust solution.

Our solution

Our opinion is that caching systems should adapt to your site, not the other way round. Issues caused by caching should be solved by fixing the caching. With this in mind, instead of implementing a workaround, we tackled the issue at its root, and wrote an algorithm for dynamic caching that takes into account the needs of a multi-currency website.

The algorithm is straightforward, and solves the issue by addressing its cause: instead of one copy of each page, it allows caching systems and plugins to store multiple copies of each page (such as one for each currency). With that in place, visitors from all over the world will see the content that applies to them, with the correct currency and taxes applied. If visitors choose another currency, or country, then our plugins track their choice, and the dynamic caching logic uses it to serve them the correct content.

Our solution grants top performance, with maximum flexibility.

Supported Systems

Dynamic caching is a great solution for highly dynamic, multi-currency sites. However, it can only work if the caching system in use supports it. As of October 2015, the following plugins and systems support, or are planning to support, dynamic caching.

WordPress Plugins

Caching Systems

For caching plugins and systems that do not support dynamic caching, disabling cache on catalogue pages is still necessary to allow the multi-currency features to work correctly.

How to add dynamic caching to your site

Adding it to your site can be as simple as copying one file, or changing one configuration file. In order to allow you to get started quickly, we wrote an implementation of dynamic caching for the following systems:

  • ZenCache/Comet Cache
  • Nginx

You can find detailed instructions to install and configure each of our solutions, as well as indications for other systems, in our knowledge base: How to add dynamic caching to your site.

We also discussed the implementation extensively with the WP Rocket Team, and provided them with code examples for integration. They confirmed that they are going to add support for dynamic caching and multi-currency sites directly in their plugin.

With dynamic caching and our Currency Switcher, your WooCommerce site will be faster and more flexible than ever!

What about systems that don’t support dynamic caching?

Plugins and caching systems that don’t support dynamic caching still have to be disabled on the catalogue, at least until they are updated. We believe that caching systems should be flexible, and support for dynamic caching is not particularly difficult to implement.

If you are using a plugin, or a caching system that doesn’t support dynamic caching, we recommend thar you get in touch with its authors and express your interest in such feature. You can also suggest them to contact us directly, if they have any questions. We will be happy to provide them with all the information they need to improve their solution.

Questions? Feedback?

We hope that you enjoyed this great news. A faster e-commerce means more customers, and that is always good! If you have any questions about our solutions, or if you would like to send us your feedback, please feel free to contact us. We will get back to you in no time.

Thank for your time and continued support.

The Aelia Team

5 Answers to common (and difficult) interview questions

After several posts focused on product release, I finally have some time to write about life as a Developer, and to answer some questions asked by my (few) readers. The most common questions I receive are about job interviews. Competition from other Developers is getting higher every day, and Companies are, understandably, getting picky, looking for Professionals who can “tick all the boxes”.

The difficulty in passing an interview, however, is not just showing that you can write code. Ironically, that’s the easy part. The difficult questions come later, when the technical interview is over, and are meant to test your personality. People who spend most of their time “talking” to machines can, sometimes, have a hard time answering human-related questions, therefore it becomes vital to prepare some answers upfront. Read more

Overview of a Developer’s Career – What Software Development is not

As I mentioned in the first post, some of the people who asked me how to become a Developer gave me the impression of having the wrong expectations. To avoid disappointment, it’s a good idea to have a look at what not to expect from a career in SD.

It’s not a “get rich quick” career

IT seems has been in a state of constant growth for many years now, and it seems it’s only going to get bigger. The market offers plenty of opportunities for a skilled Developer, and, due to the high demand of such professionals, salaries are fairly high. However, you must not expect to become a millionaire. Even if you aim to become the best Developer in the world, you won’t become rich just for that.

If your main goal is making a lot of money, I’m afraid you’re on the wrong path. You should be learning business and marketing instead. In fact, the founders of Google, Facebook, Microsoft and so on were not such great Developers at all. What made them successful were excellent timing and business skills.

Of course, you can always learn those skills as well, but the hours in a day are limited and chances are that you will have to choose something to leave behind. The truth is: Software Development doesn’t bring money. Sales bring money.

It’s not always fun

There will be moments when you’ll ask yourself why you didn’t choose another job, or simply didn’t work in your parents’ farm, instead of dealing with yet one more frustrating issues. Even if you spend sleepless night to make sure everything is perfect, you’ll always have someone in the team who will screw something up. And that person may be you, since you didn’t sleep for so long. The best thing you can do is to accept that issues are normal, and be ready when they arise. Take it easy, your passion must not be a reason to destroy your health.

It’s not an easy discipline

This is probably one the reason why so many “Developers”, to put it clearly, suck. SD is complex and it requires you to have at least a basic knowledge of other fields, such as System Administration, Networking and Design. You then have to put the pieces together, and make sure they run smoothly. Even from a pure coding perspective, you have to learn best practices, know when to use them, learn how to do proper testing, and get used to the fact that you’ll work on the same thing over and over until they are complete. Finally, you have to cope with the fact that the only projects that you’ll ever close are the ones you’ll abandon. All the others will, hopefully, in constant evolution and you’ll work on them for years.

Bottom line

There would be much more to write about becoming a Developer, but I covered some of the most important points. At least, you should now be able to evaluate your priorities and see how they would fit a career in Software Development. If you think it’s your future, I hope I’ll keep having you amongst my readers and I’ll do my best to help you.

In my future posts, I’ll write about the concepts of working smartconstructive laziness and effort investment, from a Developer’s perspective. See you soon!

Overview of a Developer’s Career – What Software Development is

A demanding and rewarding career

As for all professions, Software Development requires time and dedication. It’s one of the jobs you can’t do “just because you didn’t find anything else”. A good Developer cares about what he’s doing, he likes to find his own errors and goes through a path of continuous improvement. A typical working day won’t necessarily be 9-to-5, and you’ll often find yourself thinking about new solutions and methods outside the office. That doesn’t mean you will turn into a socially inept, lonely geek, but simply that it’s a profession where curiosity and willing to constantly learn are a must.

Does that mean you’ll always be “on the job”?
That largely depends on you. When I started, I was so eager to learn that I got books about everything related to Development (at that time, “everything” involved much less stuff than today). I spent nights studying, experimenting and banging my head against the wall to understand why something didn’t work as I expected. However, that was because I had an absolute burning passion for it. Even without being such a maniac, you’ll be able to go far by simply keeping yourself up to date.

One important suggestion that I can give you is to always keep in mind that you set your own standards. Once you’ll land in your first Development job, it will be ok to show enthusiasm and passion for it. Companies appreciate efforts and, sometimes, they reward it.  Sometimes.

However, don’t expect the rewards to always be proportionate to your efforts, especially when you go the extra mile on a daily basis. If you tell your employer that you can’t believe you’re getting paid to do something you would do for free, 24 hours a day, you are actually offering yourself to be exploited. One day you’ll like to spend time on something else, and your company won’t accept it, as you worked ’round the clock so far.

In short: find your passion, cultivate it, but don’t brag about it with your employer.

A profession where you actually DO things

One of the most important aspects of SD is that it allows, and requires, that you do something. You have to design an application or a library, write code, to test it, interact with your team, prepare analyses, learn new technologies and so on. Perhaps you won’t have to do them all, and, for sure, not at once, but you’ll be busy. Very busy. There’s really a lot to do once you’re in this world, and the best thing is that, once you’ll have found your method, it will get easier. You’ll be surprised of how much you’ll be able to deliver!

Additionally, if you’ll work smart enough (more on this later) the reward will be having your name on some popular application, and the chance to work with equally talented individuals. Note that I didn’t mention the possibility of becoming filthy rich, because that’s not on Developer’s career path. A Developer is a maker, a creator. The greatest reward one should expect is the satisfaction of having done a good job, every day. Counting the money belongs elsewhere.

A profession that can grant you excellent flexibility

Software Development can give you enormous flexibility, if you are able to handle it. It will probably take a while before companies will trust your self-management skills, but, when it will happen, you’ll enjoy a level of freedom that not many people can have.

Freedom in terms of time

Everything you’ll be working on will have a deadline. By that day, you’ll know that some things will have to be in place and working as per specifications. How you will make that happen will be up to you. In my recent employment, I work from home 90% of the time. Of that time, most is spent in the evening, or in the night, as I mind my little daughter during the day. So far, results have been excellent.

Freedom in terms of location

Thanks to the progress in telecommunications, working remotely is easier than ever. As long as you’re be able to communicate with your team, and deliver your work in a timely manner, it doesn’t matter much where you are. This gives you the chance of going on a trip (almost) whenever you like, for as long as you like. Of course, if your company is in Europe and you go to Japan, the time difference may make things more complicated, but that would be an extreme case.

The two freedoms combined

Personally, I always liked short trips, but, with standard annual leave, it’s not possible to take one or two days off every weekend. Being able to manage time and location as I see fit, I can book accommodation for mid-week dates and outside of main holiday periods. This means big discounts, less traffic and less stress. I can work from anywhere, as long as I have an Internet connection and a quiet room (essential, as SD requires focus).

Let’s now go the the the third and last part, titled What Software Development is not, in which I’ll explain what not should not be expected from a career in Development.

Do you want to become a Software Developer?

Since I started contributing to a few blogs related to the world of Software Development, I’ve received several emails in which the readers asked me to give them suggestions and recommendations on how to become a Developer. While reading these emails, I noticed each one seemed to have a different reason for wanting to become a Developer, and, unfortunately, my experiences taught me that some of those reasons are the wrong ones. Therefore, I think it’s worth spending a few words in clarifying what such profession involves. Read more