Version 1.3 of WooCommerce User Role Pricing adds full support for the Aelia Currency Switcher plugin. In addition, you can use WPML & WCML for multilingual capabilities, while using the Aelia Currency Switcher to provide multi-currency support (as opposed to using WCML Multi-Currency), and that combination is now fully compatible with the custom prices you create with User Role Pricing.
Version 2.8 of Wholesale Ordering was created and tested using version 126.96.36.199408 of the Aelia Currency Switcher.
When the Aelia Currency Switcher is active on your site, there will be a new tab”Aelia Integration” on the WooCommerce>User Role Pricing page.
The first setting is a check box labelled “Create manual wholesale currency prices?”. This is enabled by default and will create custom price fields for every currency you set up with Aelia, to allow you to enter manual custom prices for each currency. However, if you always plan on using automatic currency conversion, you can un-check this setting, and the custom price fields will NOT be shown for each currency in the product editor.
This second setting is a check box labelled “Save min/max currency prices”. This is enabled by default and will save the min & max variation custom prices for each active currency in the post meta table for the Variable parent product. If you have a lot of Variable products displayed in your shop, this may help speed up the page load time as the displayed price range will be shown by getting those saved min/max values from the database, as opposed to looping through every child variation of the Variable product, calculating the custom price for each, and determining the min and max. If you disable this feature, custom price ranges for Variable products will always be calculated by looping through all variations and calculating the price for each. However, if you are using automatic currency conversion and one of the services to automatically update exchange rates on a regular basis, you will probably want to un-check this setting, or else your displayed price ranges for Variable products will be wrong every time the exchange rates change unless you re-sync all your variable products. Note that when an individual variation is selected on the product page, the correct price will still be calculated and used for that variation, it would just be the min/max price range that would be wrong.
After Aelia has been enabled and you have added the additional currencies you want to use, you should run the Sync Variable Products function again so that default values can be set for every custom price for each currency. This should be done whether or not you are using saved min/max currency prices. After that, Variable products will automatically sync (individually) any time that you edit them.
WPML Product Translations
You shouldn’t have to change anything for User Role Pricing to work with product translations, even when using Aelia to handle multi-currency prices. The custom price fields for each currency are set to be copied to translations.
However, you need to make sure to create and translate the products the correct way for this to work. I strongly suggest that you use the WPML recommended way of using their own “WPML Translation Editor” to translate products, instead of using the “Native WooCommerce product editing screen” to edit your translations. In short, you should always duplicate your products after you create the original product in the main site language and edit the text translations using the product WPML Translation editor. Alternately, you can go directly to the Translation Editor and create translations of existing products there. Using one of those two ways, the prices and all other product fields set to “copy” will always be copied to all translations, and you won’t have to worry about prices getting out of sync between translations. If you ever need to change prices, you use the regular WooCommerce product editor, while your admin area is set to the site default language, and then just change the prices on only that version of the product. When you hit update, those prices will be copied to any other language versions.
To summarize, if you are creating a new product, make sure you are creating it in the default language of your site. After you enter all the info and publish the product, you have two ways to create the translations. Right after the product is published, you will see some new options in the Language meta box above the Publish box. You can either check the boxes for the “Duplicate” option, which will simply duplicate the product with the default language text to each translated language (you can edit the text for the other translations later), or you can click on the + signs to create the translation and open the Translation Editor for that product to edit the text right then. The third option is to do nothing, which will then leave that product in only the default language, and you can come back to it later to create the translations.
Unless you have a very strong reason to, it is NOT recommended to use the Native WooCommerce product editing screen and then to create an independent product copy for each language (you can do that if you are editing the product in a non-default language and you set the “This is a translation of” select box to “none”). If you do that and save the product, then that particular language product becomes its own separate product, with its own independent price fields (the fields will become unlocked after you publish it). At that point, you will need to remember that your different language versions of that product are no longer synchronized, so if you change the prices of one language, you need to remember to change the prices for the other language versions as well.
If you are using Aelia Currency Switcher to handle your multi-currency prices (with or without WPML), then your custom prices will work fully with Aelia, with either automatic conversions, or manual setting of prices for each currency.
If you already have custom prices entered for your products in the default language, and you enable multi-currency mode and add some additional currencies, then by default, all prices, including custom prices, will be automatically converted to the other currencies based on the currency exchange rates you set when you set up the additional currencies. There is nothing additional you need to do for this to work. However, if you have Variable products, you should run the Sync Variable Products function again so that the mix/max variation prices can be calculated for each variable product for the shop price range display (they will be calculated with the exchange rates you set). Alternately, you can disable the saving of min/max variation prices for each currency (as described above), and those price ranges will be re-calculated on every page load.
If you don’t want to use automatic currency conversion, you can manually enter your custom prices for each product or variation in each currency. You must have the option set to “Create manual wholesale currency prices?” on the Aelia Integration tab of the User Role Pricing settings page. If that is enabled (default), you will then be presented with a set of custom price fields for each additional currency. For each currency, you can manually enter a custom price, or leave it blank (placeholder will show “Auto”). If you leave it blank for one or more currencies, then the custom price for each blank currency will be automatically calculated based on the currently set exchange rate. Thus, “manual” currency prices only apply if you actually enter a custom price for that specific currency, otherwise it will still be calculated automatically. In other words, it’s not possible to not have a custom price for only some currencies… it’s all or nothing.
The only exception/quirk to the manual prices is that if you leave the custom price blank for the default currency, you can still manually enter custom prices for one or more other currencies, in which case you will only see custom prices (and only be able to add-to-cart) when viewing in one of the currencies where you did enter a price. However, if you have the User Role Pricing plugin set to hide products without a custom price, then that product will never show up in the shop loop no matter what currency you are currently set to, since the query that filter products without prices is done on the main (default currency) custom price meta field. Also, WooCommerce will sometimes remove the product from the cart saying it can no longer be purchased when there is no price in the default currency. I’m not sure why you would ever want to set up any products that way, but it is possible.