Easy Digital Downloads Currency Switcher – Support for Fees (Shipping and Recurring Payments)

Easy Digital Downloads Currency Switcher – What’s new

Currency Switcher for Easy Digital Downloads has been updated to version This update brings the following improvements and fixes:

  • Added logic to handle of EDD fees. We helped the EDD team extending the core of Easy Digital Downloads to allow the processing of fees, which may be added by 3rd party plugins. This new feature will make it possible to add multi-currency support to plugins like Simple Shipping and Recurring Payments.
  • Code cleanup. Conditionally removed filters that are obsolete in the new versions of EDD.
  • Improvements
    • Added logic to prevent double conversion of variations’ prices.
    • Fixed minor bug that could cause the historical order totals to appear as zero.

How to get latest version

New customers

Simply order the plugin from the product page and you will get the latest version.

Existing customers

You should be able to download the updated file using the link you received with your order. If the link doesn’t work, please contact Support to receive the latest version. Thanks.

WooCommerce Tips & Tricks – Get all the categories to which a product belongs

As active contributors of several communities, such as the Advanced WooCommerce and WooCommerce Help & Share groups on Facebook, we came across a question that seem to be quite frequent.

How to get all of a product’s categories

This operation is simple, it just requires a bit more work than one would expect. It’s very easy to fetch the categories to which a product is assigned directly, but a product may also belong to parent categories (a parent category is a category to which a subcategory belongs). The screenshot below explains the concept.

Product category hierarchy

In this example, the product belongs directly to “Subcategory A1” and “Some other category”. It also belongs indirectly to “Category A”, as “Subcategory A1” is a child of that category.

In the above example, the product belongs to the following categories:

  • Directly to Subcategory A1 and Some other category, as it’s assigned directly to them.
  • Indirectly to Category A, which is the parent of Subcategory A1.

Now that the concepts are clear, let’s get coding.

Step 1 – Get the direct categories of a product

This is the easiest part. It’s just a matter to find all the “category” terms associated to a product. Our function will look like this:

function aelia_get_product_categories($product, $return_raw_categories = false) {
  $result = array();
  // Get all the categories to which a product is assigned
  $categories = wp_get_post_terms($product->id, 'product_cat');
  // The $categories array contains a list of objects. Most likely, we would 
  // like to have categorys slug as a keys, and their names as values. The#
  // wp_list_pluck() function is perfect for this
  $categories = wp_list_pluck($categories, 'name', 'slug');
  return $categories;

The result of this function, once applied to our example product, will be the following:

  'subcategory-a1' => 'Subcategory A1',
  'some-other-category' => 'Some other category',

All good, we have the categories to which the product is assigned directly. Now we need to get all the parent categories.

Step 2 – Get the parent category (or categories) of a given category

To keep things tidy, we will create a second function to get the parent categories of a category. This requires a similar approach to the one used for the products.

function aelia_get_parent_categories($category_id) {
  $parent_categories = array();
  // This will retrieve the IDs of all the parent categories 
  // of a category, all the way to the top level
  $parent_categories_ids = get_ancestors($category_id, 'product_cat');
  foreach($parent_categories_ids as $category_id) {
    // Now we retrieve the details of each category, using its
    // ID, and extract its name
    $category = get_term_by('id', $category_id, 'product_cat');
    $parent_categories[$category->slug] = $category->name;
  return $parent_categories;

The above will return the following result for Subcategory A1:

  'category-a' => 'Category A'

As before, we have a list with category slugs as keys, and category names as values. Time to finish the job.

Step 3 – Putting the pieces together

Now that we can get both the direct categories of a product and their parent categories, we can alter the first function to call the second and give us a result that includes all the categories. The modified function will look as follows:

function aelia_get_product_categories($product, $return_raw_categories = false) {
  $result = array();
  $categories = wp_get_post_terms($product->id, 'product_cat');

  if(is_array($categories) && !$return_raw_categories) {
    $parent_categories = array();
    // Retrieve the parent categories of each category to which
    // the product is assigned directly
    foreach($categories as $category) {
      // Using array_merge(), we keep a list of parent categories
      // that doesn't include duplicates
      $parent_categories = array_merge($parent_categories, aelia_get_parent_categories($category->term_id));
    // When we have the full list of parent categories, we can merge it with
    // the list of the product's direct categories, producing a single list
    $categories = array_merge($parent_categories, wp_list_pluck($categories, 'name', 'slug'));
  return $categories;

As you will probably have guessed, the new function will return the following result:

  'subcategory-a1' => 'Subcategory A1',
  'some-other-category' => 'Some other category',
  'category-a' => 'Category A',

That is, a list of all the direct and indirect categories to which a product belongs. Mission accomplished!

For your convenience, you can find the complete code here: WooCommerce – WooCommerce – Get product categories, including parent categories (Pastebin).

Need help?

Should you need help implementing the solution, or if you would need to have the category search functions implemented as part of a more complex custom project, please feel free to contact us. We will review your specifications and give you a quote for your customisation.

The Aelia Team

SIP Frontend Bundler now supports Aelia Currency Switcher for WooCommerce

We are delighted to inform you that a new plugin joined the multi-currency family. The SIP Frontend Bundler, developed by ShopitPress, now includes full support for our ever popular Currency Switcher for WooCommerce. Together, they will grant you unprecedented flexibility in offering attractive bundles to your customers, helping you increasing your revenue.

What can the SIP Front End Bundler do for you?

In short, it allows your customers to configure and buy product bundles, straight from your front page. The price is updated in real time, so that the buyer can immediately see how much he is going to spend, and adjust the bundle accordingly. Easy to explain, easy to use!

Some of the exclusive features provided by the SIP Front End Bundler

  • Let customer crate their own bundle
    No need to spend time creating pre-configured bundles, one by one, hoping to get it “just right”. Just select the products that can be bundled together, and let your customers create their own set.
  • Real-time price display
    Customers like to know in advance how much they are going to spend, possibly without having to manually compare multiple product combinations. The SIP Frontend Bundler will show them how much they are saving in real-time, as the customer build its own bundle.
  • Build your bundle from anywhere
    The SIP Front End Bundler for WooCommerce can show the bundle builder in any page on your site. Your customers will love to create their own bundles right from the front page, instead of having to go through a long catalogue.
  • Fully supports the Aelia Currency Switcher
    Thanks to the collaboration between Aelia and ShopitPress, the SIP Front End Bundler includes full support for our Currency Switcher for WooCommerce. Sell your bundles in multiple currencies and increase conversion!

Multi-currency Bundles in WooCommerce, made easy!

This is another great result of a collaboration between teams who share the same vision, and who recognise the importance of being able to offer your products to a worldwide audience, catering to a large range of needs. Just like our Currency Switcher for WooCommerce, which was born to grant customers the flexibility to pay in their preferred currency, the SIP Front End Builder grants them the freedom to create their own special offers, quickly and easily.

We would like to thank the ShopitPress team for the effort they put in developing such a powerful, yet easy to use solution for the management and creation of bundles. Well done, and keep up the good work!

Are you a plugin developer?

If you are a plugin developer, and would like to learn how to add multi-currency capabilities to your products, please feel free to get in touch. We will be happy to give you the information you need for a quick start, as well as examples that will simplify the integration with our Currency Switcher for WooCommerce. You will join the ever-growing list of teams who support such an important feature, amongst which you can find SkyVerge, Prospress, YIThemes, ThemeComplete and, of course, ShopitPress.

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

The Aelia Team

WooCommerce Currency Switcher – Support for Composite Products

Following multiple requests from our customers, we have been working with the developers of the Bundles and Composite Products plugins to introduce full compatibility with our Currency Switcher for WooCommerce.

Support for bundles is currently provided by our free Bundles Integration Addon, which will work as a temporary solution while SomewhereWarm, the authors of the Bundles plugin, update their product. It may take a while before the same features are ported to the Composite Products plugin, therefore we decided to start testing that plugin in our environment, to determine which features should be added to make it support our Currency Switcher.

Composite Products – Compatibility Status

Our tests, performed with the Composite Products 3.6.4, indicated that the plugin is already quite compatible with our Currency Switcher. You can find more details below:

Products with per-item pricing

  • The prices of components are converted correctly. The conversion is performed on each component individually, before its price is used, and each component uses its currency-specific prices, where applicable.
  • Product’s base prices (regular and sale) are not yet converted. These values have been introduced recently, and they will have to be passed to the conversion functions.

Products with simple pricing

  • The price of the composite product is converted correctly, using exchange rates.
  • The prices in each currency are not saved, as the product requires a special processing for that purpose.

What’s next

We are going to run more tests and give the authors of the Composite Products plugin the information required to address the issues reported above.

Should we find out that it could take too long, we will try to write an addon, like the one we wrote for the Bundles plugin, as a temporary solution. If you would like to be informed when the addon is released, or you would like to contribute to its development, please feel free to contact us, and we will send you more details.

Update – 4th May 2016

The Composite Products Integration is now available, free of charge!

The Aelia Team

WooCommerce Moneris Extended Gateway – Support for Hosted Tokenization ID

WooCommerce Moneris Extended Gateway – What’s new

WooCommerce Moneris Extended (multi-account) Gateway has been updated to version This update brings the following improvements and fixes:

  • Added support for currency-specific Hosted Tokenization Profile IDs
    Up until version 2.4, the Moneris gateway that our plugin extends didn’t allow to change the hosted tokenization profile ID on the fly. Due to that, if the tokenization feature was enabled, the same profile ID was used for transactions in both USD and CAD, causing the payment to fail for one of the currencies. Version 2.5 of the Moneris gateway was made more flexible from this perspective, and it’s now possible to enter two separate tokenization IDs for US and Canadian Dollars.
  • Improved error handling in wc_moneris_api_request_auth_info filter
    Handled condition when the Moneris gateway doesn’t pass an order with the filter. This is an edge condition, but it can happen in some circumstances, causing the payment to fail. The improved error checking will handle such condition gracefully, allowing payments to complete successfully.

How to get latest version

New customers

Simply place your order and you will get the latest version.

Existing customers

You should be able to download the updated file using the link you received with your order. If the link doesn’t work, please contact Support to receive the latest version. Thanks.