Posts

news icon

RightPress Dynamic Pricing and Discounts now supports our Aelia Currency Switcher

Dynamic pricing rules and multi-currency, together

The RightPress Team informed us that their powerful Dynamic Pricing and Discounts plugin for WooCommerce now supports our leading multi-currency solution, the Aelia Currency Switcher. This is an excellent improvement for their already great product. It will allow merchants to configure flexible discount rules for their multi-currency shop.

The support for our WooCommerce Currency Switcher is included in Dynamic Pricing and Discounts since version 2.0, available now. You can get this great product from CodeCanyon, at a fantastic price!

We would like to thank the RightPress Team for the great work they did to support our multi-currency solution. Their hard work will help thousands of merchants to have a powerful and flexible shop, to cover the needs of their international customers. Their collaborative spirit sets a great example, that we hope many other developers will follow.

Thanks for reading, and see you soon for more exciting news!

The Aelia Team

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

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