Posts

news icon

Currency Switcher 4.x is now available, supporting WooCommerce 2.7

Currency Switcher 4.x is available!

As announced last week, we are delighted to announce that we have just released our next major update for our popular Currency Switcher for WooCommerce. As anticipated, this version includes support for WooCommerce 2.7, and has been tested with the Release Candidate of that version.

Several of our customers opted for a preliminary test and received the new release in advance. They are now enjoying the benefits and improvements it introduces, and they are pleased of how well it works.

Here you can find a list to recap main features in this new version.

Compatibility with WooCommerce 2.7

The latest version of the Currency Switcher is compatible with the new features introduced in WooCommerce 2.7. We tested our plugin against WC 2.7 Beta 1, back in December 2016, then again with the Beta 2 and the Release Candidate version. The results have been great. Of course, we will keep testing it and address any glitch that we will find.

Optimised code, taking advantage of the Aelia Foundation Classes library

Our Aelia Foundation Classes (AFC, for short) is indeed the foundation of most of our plugins. The mini-framework we designed is flexible enough to allow us to keep the main plugins small and lean.

Also, thanks to the features in the AFC, our products can easily check the system for missing requirements, and even install other plugins they might need, with a single click. We consider ourselves “pioneers”: in an environment where packaging bulky frameworks with each plugin is common practice, we went for lean plugins, shared libraries and dependency management. It wasn’t easy, but it worked!

Better performance

We optimised the currency conversion logic in the Currency Switcher to make it easier to use it on shops with a large number of products. The currency conversion logic is now up to 80% faster. This is especially visible on sites with a high number of variable products and/or of variations.

Improved logging

To keep in line with our “lead the way philosophy”, in July 2016 we developed a flexible logging system, which we are going to use in all our plugins. Our new logger  is PSR-3 compliant, powerful and flexible. We were pleased to hear that WooCommerce 2.7 will introduce a similar logger system, as it’s a proof that we have been, and we still are, on the right track. Our plugins will keep using our own logger, and the two systems will live next to each other, transparently.

Improved geolocation

The Aelia Foundation Classes framework loads version 2 of the MaxMind Geolocation database. The database supports a finer granularity than the one included with WooCommerce. That’s what makes it possible to detect not only countries, but also provinces/states/counties and, in some cases, cities. We have been using it in our Prices by Country and Tax Display by Country plugin for over a year, with great results.

Improved reports

We extended the reporting capabilities of the Currency Switcher to allow running reports filtered by currency. Each report will show the exact total of sales made in each currency. Thanks to this feature, it will be easier to find out which currency generates the most sales, and adjust your sale strategy.

Here are some screenshots of the new reports:

Currency Switcher 4.x - Sales report in EUR

The new sales report in the Currency Switcher 4.x, showing the sales made in EUR

Currency Switcher 4.x - Sales report in USD

The new sales report in the Currency Switcher 4.x, showing the sales made in USD

New shortcodes

The Currency Switcher 4.x includes a couple of new, handy shortcodes. You can use them to convert arbitrary values in on the page, or show a product price in the active currency, anywhere on your site. Here’s a brief description of how they work, together with a “live” example.

Try selecting a currency, on the right sidebar, and the values in bold will change automatically.

It’s now possible to force the currency by shipping country

We added the “force currency by billing country” to the Currency Switcher over two years ago, albeit reluctantly. For those not familiar with it, the feature allows customers to select a currency indirectly. Instead of going for the currency, they can select a billing country, and the currency changes to the one used in such country. Since we received several requests to allow binding the currency to the shipping country, we added such option to the new release.

Currency Switcher 4.x - Force currency by shipping country

The Currency Switcher 4.x allows to force currency by shipping country, as well as billing country.

Currencies can now be sorted in the settings page

Some of our customers asked if it would be possible to sort the enabled currencies without having to resort to a filter. We listened to our clients, and such feature is now part of the Currency Switcher. Here’s a preview of the interface that allows the sorting:

Currency Switcher 4.x - Sort currencies

Drag the handle of each currencies to change their order, then save the settings the new sorting.

Of course, if you implemented a  filter for your custom sorting, you can keep using it, it will work just fine.

Dropped support for WooCommerce 2.3 and earlier

The Aelia Team is known for its skill in keeping full backward compatibility in all our products, even after adding or improving existing features. Our Currency Switcher 3.x was fully compatible with WooCommerce from version 2.1.x until 2.6.x, and worked seamlessly on each of those version. After a careful analysis, we realised that WooCommerce 2.3 and earlier have practically disappeared from the market. Thus, keeping the code to support those versions makes little sense. Due to this, the Currency Switcher 4.x now requires WooCommerce 2.4 or newer.

Integrations with 3rd party plugins are now external addons

The Currency Switcher used to include integrations with several 3rd party plugins. We quickly realised that, even though such solution looked convenient, the integrations don’t belong there, as not every merchant needs them. Thus, we decided to extract each integration to a separate, lightweight plugin, so that the user can install only the needed ones. The integrations will work the ones we released so far, supporting plugins such as Subscriptions, Bundles, Composite Products, Product Add-ons and, more recently, Dynamic Pricing.

To make sure that users are aware of the changes, the Currency Switcher will inform merchants when an integration is no longer included in the main plugin. The Currency Switcher will also explain how to download the replacement integration.

When will the Currency Switcher 4.x be available?

The Currency Switcher 4.x is a available now! 🙂

Will I have to pay for the new version?

If you are an existing customer, with an active licence, you can download the Currency Switcher 4.x free of charge. Simply go to the My Account section and you will find the link to download it.

If you are not yet a customer, or if your licence expired, please contact us to get the best deal to get the new version of our product.

As always, please feel free to send us any feedback you have about this new version. We would like to thank you in advance for taking the time to write us, as your feedback is what allows us to provide you with top class solutions.

Thanks for reading, and for your continued support and renewed custom.

Sincerely,

The Aelia Team

news icon

Announcing Currency Switcher 4.x, with support for WooCommerce 2.7

Currency Switcher 4.0 is coming, with great improvements

We are reviewing and updating our popular Currency Switcher for WooCommerce, in preparation for the upcoming release of WooCommerce 2.7. Our next major version will be 4.0, and it will include several updates and enhancements, which you can find listed below.

Several of our customers are already enjoying the benefits of this new release, and we received great feedback about the improvements we introduced. Here is a list of the major changes that the Currency Switcher 4.0 will bring.

Compatibility with WooCommerce 2.7

We updated the Currency Switcher to make it compatible with the new features introduced in WooCommerce 2.7. Tests of the new release against WC 2.7 Beta 1 and Beta 2 are completed, and the results have been great. We will keep testing it, to “iron all the kinks”, and ensure a smooth transition from WooCommerce 2.6 to 2.7

Optimised code, using our powerful Aelia Foundation Classes library

Several months ago, we decided to extract libraries and classes that were shared by our plugins, and move them to an external plugin, called the Aelia Foundation Classes. Then, we redesigned our products to use this new library. It was a bold move, but it paid off. Our customers are impressed by the efficiency of such solution, which allows us to keep our software small and lean. We also developed a smart dependency checker is able to detect any missing dependency and install it with one click.

We understand that it’s uncommon, in the WordPress environment, to have plugins depend on frameworks or other plugins, but that is going to change in the future. Dependencies are common in most other frameworks and Content Management Systems, and having to install a single extra plugin is a small price to pay in return for more efficient solutions. Smart dependency management is now a reality!

Better performance

The number of large WooCommerce sites is increasing constantly. In order to allow merchants who run large shops to take advantage of our multi-currency solutions, we reviewed the performance of the core elements of the Currency Switcher. The new currency conversion logic is now up to 80% faster, especially on sites with a high number of variable products, and a large number of variations.

Improved logging

At Aelia, we like to consider ourselves pioneers in introducing great and useful features. When we heard that WooCommerce 2.7 will also introduce a new logging system, we had a moment of pride: we introduced an equally flexible, if not more powerful, logging system in our Aelia Foundation Classes, back in Q3 2016. Our new logging system will be used by all our plugins, running in parallel to the one added to WooCommerce, without interfering with it. It will make it possible for us to assist your customers more effectively, and troubleshoot issues quickly.

Improved geolocation

The Aelia Foundation Classes includes version 2 of the MaxMind Geolocation database, which is updated automatically, on a weekly basis. This is the same database that our Tax Display by Country and Prices by Country plugins already use, which is more flexible than the one used in Currency Switcher 3.x.

Improved reports

Following our valued customers’ feedback, we extended the reporting capabilities of the Currency Switcher. Reports can now show sales filtered by currency, showing the exact total of sales made in each currency. Such feature will make it easy to find out which currency generates the most sales, and adjust sale strategies accordingly.

You can find some screenshots of the new reports below:

Currency Switcher 4.x - Sales report in EUR

The new sales report in the Currency Switcher 4.x, showing the sales made in EUR

Currency Switcher 4.x - Sales report in USD

The new sales report in the Currency Switcher 4.x, showing the sales made in USD

New shortcodes

The Currency Switcher 4.x includes new shortcodes that can be used to convert arbitrary values in on the page, as well as displaying a product price in the active currency anywhere on the site. You can see them in action below.

Try selecting a currency, on the right sidebar, to see the above value changes.

Support for forcing currency by shipping country

The “force currency by billing country” feature was introduced long ago. As the name implies, it allows to force the active currency to the one used in the billing country selected by the customer. Although we normally recommend not to use such feature (the Currency Switcher wad designed to grant customers the freedom to choose the currency in which they want to pay), we have received several requests to extend it, and now the currency selection can be tied to the shipping country, rather than the billing one.

Currency Switcher 4.x - Force currency by shipping country

The Currency Switcher 4.x allows to force currency by shipping country, as well as billing country.

End of support for WooCommerce 2.3 and earlier

At Aelia, we pride ourselves in our ability to include backward compatibility in all our products. Our Currency Switcher 3.x is fully compatible with WooCommerce from version 2.1.x until 2.6.x. Despite such impressive feat, we realised that WooCommerce 2.3 and earlier versions are rarely in use, and maintaining the code to support it makes little sense. Due to this. the Currency Switcher 4.x will require WooCommerce 2.4 or later.

Separation of integrations with 3rd party plugins

Some of the integrations with 3rd party plugins are currently part of the Currency Switcher’s core, although they don’t belong there. They were originally included in our main product as a temporary, quick patch, and it’s now time for some housekeeping. We will progressively extract the integrations to separate plugins, like the ones we released for the Subscriptions, Bundles, Composite Products and Product Add-ons plugins.

To make sure that users are aware of the changes, the Currency Switcher will notify the site administrator when an integration has been removed from it, and propose an alternative solution to it.

When will the Currency Switcher 4.x be available?

The Currency Switcher 4.x is already stable, and can be used on WooCommerce 2.6 (we have been using it on our own site for months now). It also works fine with WooCommerce 2.7 Beta 2, which is the latest public release. We plan to release our major update when WooCommerce 2.7 reaches Release Candidate 1, to make sure that we can address any glitch that might have “slipped through the cracks.”

Will I have to pay for the new version?

If you are an existing customer, with an active licence, the upgrade to version 4.x of the Currency Switcher will be free of charge. If you wish to try the new version before its official release, please contact us. We will be happy to send you the updated version.

If you are not yet a customer, or if your licence expired, and you would like to try our powerful multi-currency solution, simply buy the Currency Switcher and contact us afterwards to receive the free update to version 4.x.

As always, we will be grateful for any feedback you can give us, as it allows us to improve our products.

It was a long read, but we hope it was worth it. Thanks for dedicating us your time, we are looking forward to the new, exciting update!

Sincerely,

The Aelia Team

news icon

WooCommerce EU VAT Assistant – Make VAT number optional when cart total is zero

Recently, we have been asked for a customisation for the EU VAT Assistant, to cover the following scenario:

  • The VAT number should be required to complete a purchase, if a payment has to be made.
  • The VAT number should not be required if the checkout doesn’t require a payment (i.e. if the cart total is zero). This could be the case if the customer only adds free products to the cart.

The above scenario is outside the scope of the EU VAT Assistant. The purpose of the “VAT number required” option is to force only B2B transactions. By making the VAT number required, only verified businesses can complete a transaction. By design, this rule applies whether the transaction requires a payment or not.

If you need to make the VAT number required only when a payment is needed, you can easily do so with a customisation. Your custom code will have to cover two elements:

  1. The validation of the VAT number on the checkout page
    When the field is set as “required”, the customer cannot go ahead with the checkout until such field is filled. For this part, we will rely on JavaScript to show or hide the VAT number field dynamically, as well as making it required, or not required
  2. The validation of the VAT number during the checkout process
    For this part, we will use a simple filter to verify if the VAT number should be required during the final checkout phase.

Now we have a plan, let’s get started.

Step 1 – Expose the cart total to the JavaScript frontend

The cart total is not easily accessible via JavaScript, as it’s not stored in the data returned by the Ajax requests triggered on the checkout page. Luckily, there is a convenient  filter that will allow us to add that information, called woocommerce_update_order_review_fragments. Our filter will be the following.

/**
 * Adds the cart total to the fragments returned as a response to the Ajax
 * requests on the checkout page.
 *
 * @param array fragments The fragments returned as a response.
 * @return array
 */
add_filter('woocommerce_update_order_review_fragments', function($fragments) {
  $fragments['_cart_total'] = WC()->cart->total;
  return $fragments;
});

Done. Now, every time the checkout form changes, we will have the cart total handy.

Step 2 – Get the cart total from the fragments, via JavaScript

Now that we have the cart total exposed to the JavaScript on the checkout page, we can use it to show or hide the VAT number field, as well as change its “required” status. For that purpose, we just have to add a simple script to the page footer.

/**
 * Adds a script to the checkout page, to make the VAT number required or not
 * required, depending on the cart total.
 */
add_action('wp_footer', function() {
  // We need to render our script only on the checkout page
  if(!is_checkout()) {
    return;
  }
  ?>
  <script>
  jQuery(document).ready(function($) {
    // Run the script every time the checkout form is updated. This will
    // allow us to check if the total changed
    $(document.body).on('updated_checkout', function(ev, data) {
      if(!data['fragments'] || !data['fragments'].hasOwnProperty('_cart_total')) {
        return;
      }

      var cart_total = parseFloat(data['fragments']['_cart_total']);
      var vat_number_required = (cart_total > 0);

      var $eu_vat_number = $('#woocommerce_eu_vat_number');
      // Show the VAT number is the cart total is greater than zero,
      // hide it otherwise
      $eu_vat_number.toggle(vat_number_required);
      // Make the VAT number required only if the cart total is greater than zero
      $eu_vat_number.find('.form-row').toggleClass('validate-required', vat_number_required);
    });
  })
  </script>
  <?php
});

With this script, we covered the checkout page. The VAT number will appear automatically when the cart total is greater than zero, and disappear when it’s not. Customers will be able to checkout without entering a number, if no payment is needed.

Step 3 – Make the VAT number optional during the checkout process

This is the last step, to allow the checkout to complete when the cart total is zero and the customer did not enter a VAT number. This filter is very simple.

/**
 * Sets the VAT number field as "not required" when the cart total is zero (or
 * less; which should never happen, but better to cover that case).
 *
 * @param bool is_vat_number_required Indicates if the VAT number is required.
 * @param string country The billing country selected at checkout.
 * @return bool
 */
add_filter('wc_aelia_euva_order_is_eu_vat_number_required', function($is_vat_number_required, $country) {
  // Make VAT number "not required" if the cart total is zero
  if($is_vat_number_required && (WC()->cart->total <= 0)) {
    $is_vat_number_required = false;
  }
	
  return $is_vat_number_required;
}, 10, 2);

That’s it. We covered the checkout process as well. The result will be the following:

  • When the cart total is greater than zero, the VAT number will be required. It won’t be possible to complete the checkout without entering it.
  • When the cart total is zero, the VAT number will be hidden, and optional. Customers won’t need to enter it.

You can find the complete code here: WooCommerce – Make VAT number optional if cart total is zero (Pastebin).

Need help?

Should you need assistance adding this custom code to your site, or if you need it tailored to your needs, you can hire us on Codeable. We will analyse your specifications and send you an estimate for your customisation.

Thanks for reading, and for using our EU VAT Assistant. See you soon for the next WooCommerce Tips & Tricks!

The Aelia Team

news icon

Get 10% off a WP Rocket licence!

As many of you know, caching is a sensitive topic when running a multi-currency, multi-price, or in any way highly dynamic e-commerce. That’s why we worked with the WP Rocket Team to add support for all the Aelia plugins in WP Rocket, while maintaining the top performance that their product provides.

As of version 2.8, WP Rocket supports all our plugins, out of the box, and it’s our recommended commercial caching plugin.

The best news is that now you can get 20% off the price of a WP Rocket licence by using coupon code <coupon expired>. Simply go to https://wp-rocket.me, add the licence to your basket, and enter the coupon code at checkout. You will get the best caching plugin on the market, at an even greater price!

Update – June 2017

The original coupon  is now expired. You can now use coupon code aeliacs-10 to get 10% off your WP Rocket licence. 🙂

The Aelia Team

news icon

WooCommerce 2.6 is out – Make sure that your plugins are up to date

WooCommerce 2.6 was released today, 14th June 2016. This update brings several new features, the most remarkable being the introduction of shipping zones, which will make your site more flexible and powerful than ever.

We updated our plugins some weeks ago for compatibility with WooCommerce 2.6, to guarantee compatibility with the latest WooCommerce version on the release date. Please make sure that you update our plugins before installing the new WooCommerce, to ensure that your site will work correctly. This is particularly important if you are using the Shipping Pricing Addon for the Currency Switcher, or the Aelia Currency Switcher itself, which were directly affected.

Should you have any questions, or need assistance, please feel free to contact us. We will get back to you as soon as possible.

The Aelia Team

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