FOX - Currency Switcher for WooCommerce

woocs_convert_price

The woocs_convert_price filter is an entry point into the plugin: you call it, FOX answers. It converts an amount from the shop base currency into the currency the visitor has selected. This is the standard way for third-party code to become currency aware. Because it is a filter, the call is safe even when FOX is not installed — the value passes through unchanged, which is exactly what compatibility code needs.
global $WOOCS;

$converted = apply_filters('woocs_convert_price', $amount, false);
Parameters:
  • $amount - the amount in the shop base currency
  • $is_cond_multi (bool) - false by default. When true, the conversion happens only if the "Is multiple allowed" option is enabled, so the call becomes a no-op on shops that charge in the base currency only
Returns:
  • the amount in the current currency
The other direction is woocs_back_convert_price, which takes an amount that is already in the visitor's currency back to the base one. That is the one to reach for when a plugin compares a cart total against a threshold it stored in the base currency — free shipping minimums, gift rules, tiered discounts. Comparing a converted number against a base-currency threshold is the single most common cause of "the rule works in USD but not in EUR".