Posts

Aelia - News badge

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

Aelia - News badge

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

Aelia - News badge

Happy new year! Time to update VAT rate for Romania

Happy new year to you all! We hope you had some great Christmas time, and that you are ready for a great 2017. Considering how 2016 went, it can only get better!

The new year starts with a good news for our Romanian friends. As announced last year, the Romanian government reduced the standard VAT rate from 20% to 19%, from the 1st January 2017.

This means that your products will be slightly cheaper. It would be a good idea to update your tax settings as soon as possible.

How to update the tax rates

Updating tax rates is a simple operation:

  1. Go to WordPress Admin > WooCommerce > Settings > Tax.
  2. Click on the tax rate you would like to update (e.g. “Standard“), at the top of the page.
  3. Change the rate in the row with the country code “RO” to “19”.
  4. If needed, update the tax rate description.
  5. Save the changes.

Now all that’s left is double checking that all tax rates are correct. Our plugin updates the rates related to EU countries, therefore you will have to check the rates that refer to countries outside the European Union. If you don’t have any, then you’re done. WooCommerce will now use the new rates for orders placed from now on, and our plugin will collect the tax data automatically.

Again, best wishes for an incredible 2017 from the Aelia Team. May the new year be full of joy and, of course, business opportunities!

The Aelia Team

Aelia - News badge

Advanced WooCommerce Reporting adds native support for multi-currency reports

One of our clients informed us that the popular Advanced WooCommerce Reporting plugin now supports multi-currency setups. Its authors introduced this feature in version 3.0 of their product, which was released at the beginning of October 2016.

This is a fantastic news, as it means that it will be possible to produce advanced reports, with a few clicks, and have a complete overview of how your shop is performing. Make sure that you have a look at the latest version of Advanced WooCommerce Reporting, you can find it on CodeCanyon.

It’s great to see more developers join our efforts to make WooCommerce and Easy Digital Downloads fully support multi-currency scenarios. We would like to thank Proword (the plugin’s authors), for recognising the importance and relevance of multi-currency shops, and for the work they’ve done in supporting merchants who run these shops. Thanks to them, tracking the performance of worldwide sales has become easier than ever!

The Aelia Team

Aelia - News badge

Pressidium add native support for Aelia plugins in their caching layer

This week starts with a great news! We have just been informed that Pressidium, a high performance hosting company, can now support Aelia products natively. At a simple request, they can to configure their caching layer to work with all of the WooCommerce plugins we developed.

Thanks to this feature, their dynamic caching will be able to take into account customer’s location, currency and tax settings. Your site will display the correct information to all your visitors, as soon as they land on your site, at a lightning fast speed!

Sounds great? Yes, we think so!

How to get support for Aelia plugins on Pressidium

That couldn’t be easier: if you have your site hosted with Pressidium, simply contact their support team, and ask them to enable support for the Aelia plugin on their caching layer. That would be all!

In the unlikely event in which the support person is not familiar with the setup, you can simply forward them the link to our documentation: Aelia- How to add dynamic caching to your site. They will know what to do to get your site blazing fast.

 

We are sure that you are as excited as we are about this excellent news. Super fast, multi-currency sites are now at your fingertips!

The Aelia Team

Aelia - News badge

EU VAT rate update – Greece

We have recently been informed that the standard VAT rate for Greece was changed on the 1st June 2016, from 23% to 24%. Some changes were made to reduced VAT rates as well.

We would recommend to take the opportunity to update the VAT rates configured in your system, to make sure that you are using the correct ones.

How to update the tax rates

Updating tax rates is a simple operation:

  1. Go to WordPress Admin > WooCommerce > Settings > Tax.
  2. Click on the tax rate you would like to update (e.g. “Standard“), at the top of the page.
  3. Change the rate in the row with the country code “GR” to “24”.
  4. Save the changes.

If you are using our EU VAT Assistant plugin, you can update all EU tax rates with a single click. Simply select the rate type at the bottom of the page and click on Update EU VAT Rates. Make sure that you select the appropriate rates (Standard or Reduced), the plugin will do the rest.

WooCommerce Tax Rates Settings - Screenshot

With our EU VAT Assistant you can update all VAT rates with a single click

Once the operation is completed, review the tax rates, to ensure that they are correct, and click on Save Changes. WooCommerce will now use the new rates.

Quick and easy! 🙂

The Aelia Team