Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Pricing

Jonathan Moore edited this page Jun 18, 2017 · 10 revisions

Pricing is normally synchronised across all language versions of a product but can be turned off under Settings, Metas. It's not clear why you might want to turn this off, generally, Customers are annoyed if they discover that the price changes when switching language, so if you have a good use case please add it here.

Sale price in one language only

Maybe you have a marketing campaign in one language only and you want to create some offers which only apply to one language? If you turn off the sale price and final price meta synchronization Settings, Metas your sale prices will not be synchronized and so will only apply to the language they are entered. This does add to maintenance complexity, it is simpler to leave on. If you do want to make an offer applying in one language only, you can also do this with coupons, for example make a coupon that applies only to certain language-specific categories.

Currencies

The ability to turn off price synchronisation is not intended to support different currencies for different languages. It's not recommended to couple language to currency, since languages such as English, Spanish, French, Arabic are used in many countries with different currencies, and indeed many countries have speakers of multiple languages. (Eg: Spanish speakers in USA, French speaking provinces of USA and Canada etc etc).

Currency Switchers

It's hard to recommend particular currency switchers since most require a paid version for more than 2 currencies, some have no free version and perhaps none are functionally complete. But there are quite a few options and different strategies, so the recommendation will depend which requirements are important for you.

Cache compatibility note.

  • Full html page output caching can give very significant (12x or more) speed and throughput [SuperCache with mod-rewrite and pre-cache or intermediary caching solution]. Most currency-switchers are not compatible.
  • Automatic geolocation-based currency switching may not work (because no server-side PHP code is executed - that's why it's fast). [Geolocation and automatic switch is also not entirely accurate or user friendly.]
  • WooCommerce Geolocate (with page caching support) adds an extra url parameter to break the cache by geolocation hash, which also requires some PHP execution to initially get the user geolocation. While this is "compatible" with caching, some benefits are lost, for example it would be difficult to pre-cache different versions of each page for all the possible geolocations.
  • Free edition supports 2 additional currencies and is licensed under GPL3.
  • Tool has some nice options for Exchange Rate final price corrections
  • Allows checkout in selected currency, doesn't have configuration option for per-currency gateway availability
  • Product-level per-currency pricing can also be set, but is not currently synchronised across languages, there is a code snippet for that at the end of the [[Product Meta page|Product-Meta-and-Custom-Fields].
  • Not cache compatible
  • Algoritmika also produce Booster for WooCommerce which has much more extensive features and seems to use the same url parameters etc as the Currency Switcher for WooCommerce.
  • Free edition supports 1 additional currency.
  • Full cache support via javascript
  • Allows checkout in selected currency, doesn't have configuration option for per-currency gateway availability
  • no Free edition
  • Free cache plugin: WooCommerce Cache Handler (and Aelia Foundation Classes for WooCommerce which it requires) are free and enable a Cache Handler page within WooCommerce settings with an option for "Enable Ajax Loader"
  • possible the most complete implementation with it's own cache strategy, per-currency payment gateways, differential pricing (markup/margin per currency) etc
  • no Free edition
  • Javascript (so should be cache compatible)
  • limited features, front end indicative price only, checkout always in store base currency
  • woocommerce.com support

Localizing Currency Switchers

Most currency switchers do not implement localization, for example the number formats are fixed per currency without taking into account the current language/locale convention.

Here are some code snippet examples for localization:

  • How to Synchronize extra product information to Product translations eg per-currency product pricing: see code snippet at the end of the Product Meta page.
  • How to localize WooCommerce Currency Switcher: this code snippet will override the configured non-localized currency settings with localized settings, similar techniques may apply to other plugins:
add_filter( 'woocs_currency_data_manipulation', 'localize_currency_switcher', 10, 1);
/*
 * Localise initialization parameters for WooCommerce Currency Switcher, if installed:
 *  
 * 	    'USD' => array(
 *		'name' => 'USD',
 *		'rate' => 1,
 *		'symbol' => '$',
 *		'position' => 'right',
 *		'is_etalon' => 1,
 *		'description' => 'USA dollar',
 *		'hide_cents' => 0,
 *		'flag' => '',
 */
function localize_currency_switcher($currencies){
    $woo_localized_descriptions = get_woocommerce_currencies();
    foreach ($currencies as $currency){
        $code = $currency['name'];

        //use preset description
        $description = $woo_localized_descriptions[$code];
        if ($description){
            $currencies[$code]['description']=$description . ' (' . $code . ')';
        }

        //localize position and hide_cents where possible
        $locale = pll_current_language('locale'); 
        $formatter = new \NumberFormatter($locale.'@currency='.$code,  \NumberFormatter::CURRENCY);
        if ($formatter){
            $symbol=$formatter->getTextAttribute(\NumberFormatter::CURRENCY_SYMBOL);
            if ($symbol){
                $currencies[$code]['symbol'] = $symbol;
            }
            
            $prefix=$formatter->getTextAttribute(\NumberFormatter::POSITIVE_PREFIX);
            $currencies[$code]['position'] = (strlen($prefix)) ? 'left' : 'right';

            $decimals = $formatter->getAttribute(\NumberFormatter::FRACTION_DIGITS);
            $currencies[$code]['hide_cents'] = ($decimals) ? false : true;
        }
        
    }
    return $currencies;
}