Posts

news icon

The ELEX DHL Shipping plugin now supports our Aelia Currency Switcher

DHL Shipping and Currency Switcher, now working together

Updated December 2019

This article was originally published in December 2017. The XAdapter DHL Shipping plugin is now called ELEX DHL Shipping, and it’s developed and maintained by ELEXtensions.

In the past weeks, we have been working with the team at ELEX to add support for our WooCommerce Currency Switcher to their DHL Shipping plugin. The target was to make their shipping plugin more flexible, and to make it possible to interact with the shipping calculation process, to ensure the correct calculation of prices in all currencies.

We are happy to inform you that the integration is now complete. Starting from version 3.4.3, the DHL Shipping plugin includes the filters and actions we added in a modified version to make multi-currency support possible. Thanks to this filter, it’s now possible to interact with the shipping plugin and ensure accurate shipping costs. Sounds great? Good! Keep reading to learn how to implement the solution on your site!

Getting started

Adding multi-currency support to the DHL shipping on your site is a matter of performing three simple steps:

  1. Update the ELEX DHL Shipping plugin. Make sure that you are running version 3.4.3 or later.
  2. Add a simple filter to your theme’s functions.php file, as described in ELEX’s knowledge base:  WooCommerce DHL Express/Paket Shipping Plugin – How to use the DHL shipping plugin with the Currency Switcher plugin. The filter is what allows the DHL plugin and our Currency Switcher to work together, to ensure the accuracy of the shipping calculations.
  3. Alter the filter you just added, replacing the currency in it with the code of your shop’s base currency. For example, if your base currency is EUR, simply replace the “ZAR” from the example with “EUR”.

You’re now ready to go! The custom filter you just added will tell the DHL Shipping plugin to fetch the shipping costs in your shop’s base currency, and our Currency Switcher will take care of converting them to the correct active currency on the cart page and at checkout.

Should you have any questions about using the DHL Shipping with our Currency Switcher, please contact the ELEX Support Team. They will be happy to assist you in configuring their shipping plugin on your site.

Thanks for reading, and have a wonderful day!

The Aelia Team

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

WooCommerce Product Table and Password Protection plugins now support Currency Switcher and Prices by Country

Barn2 Media’s WooCommerce plugins now include multi-currency support

The Barn2 Media team just informed us that their WooCommerce extensions now include native support for our popular Currency Switcher and Prices by Country plugins. This means that you can benefit from the internationalisation features provided by our solutions when creating interactive pricing tables, or adding password protected areas to your site.

Would you like to know what this means for your shop? Here we go!

WooCommerce Product Table

List products in table format, in your customers’ currency and local price

WooCommerce Product Table is Barn2 Media’s bestselling plugin. It lists WooCommerce products in a sortable, searchable table view, which can also be filtered.

Product tables are useful for WooCommerce wholesale stores and bulk order forms, as well as large catalogues. They list products in a structured table layout, with more information displayed per page than the standard product pages show. The list includes details such as attributes, variations and custom fields. Customers can also purchase the products directly from the list page, which acts as a one-page order form.

If you’re using WooCommerce Product Table with our Currency Switcher or Prices by Country plugins, then the lists will automatically display the correct price for each customer, in their currency, and visitors can buy them with one click. This creates a seamless experience for your customers, which can greatly increase your conversions.

WooCommerce Password Protected Categories and Private Store

Create hidden areas within WooCommerce

Barn2 Media developed two plugins to protect or hide content within your WooCommerce shop. WooCommerce Password Protected Categories creates hidden areas which work alongside the public parts of your store. WooCommerce Private Store creates a completely hidden store – no one who visits your website will even know that you have an online shop!

As you probably guessed, these plugins are a useful addition to shops that handle wholesale customers, allowing to show some, or all products, only to customers who have specific accounts. Like the Product Tables, these plugins work beautifully with both Currency Switcher and Prices by Country. The correct currency and local price for each customer is displayed automatically on both the public and private areas of your WooCommerce store.

Acknowledgements

We’d like to thank the team at Barn2 Media for listening to the ever-increasing number of merchants who rely on our internationalisation solutions, and for their efforts in adding multi-currency support to their WooCommerce extensions.

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

 

The Aelia Team

Blacklister for WooCommerce – Support for customer’s name, address and phone number

Blacklister for WooCommerce has been updated to version 0.9.1.170222. This update brings the following improvements and fixes:

  • Added support for blacklisting of specific customer names, addresses and phone numbers. The new logic supports both simple matches and regular expressions, on each element of names and addresses. It makes it possible to blacklist specific combination of names, surnames and addresses from different areas.
  • Updated plugin code, to adhere to our newest standards.
  • Added support for auto-updates.

Acknowledgements

We would like to thank Dustin Robinson for his contribution in relation to the blacklisting of phone numbers.

How to get latest version

You can download the plugin from the product page.

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

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