FOX - WooCommerce Currency Switcher Professional

WooCommerce Fixed Price per Currency: Setup, Rules and Limits

A WooCommerce fixed price per currency means you decide what a product costs in each currency instead of letting the exchange rate decide: 49 in dollars, 45 in euros, 3,900 in rupees, whatever the rate does this week. FOX does this with per-product fields for each currency. The setup takes a minute, and most problems come from a few rules that are not obvious: where the base price goes, what an empty field means, which product types read the fields, and who is allowed to save them. All of them are below.

How fixed prices per currency work

Every product keeps its normal WooCommerce price, entered in the base currency of the shop. That price is still required: a product with only fixed prices and an empty WooCommerce price has no price at all. For every other currency, FOX looks for a fixed price on the product:

  • If the field for the visitor's currency is filled, that amount is used as typed, not converted.
  • If it is empty, the price is the base price multiplied by the currency's rate, as for any product without fixed prices.
  • A 0 counts as empty. A fixed price cannot make a product free in one currency.

So you can fix prices for one currency and let the others convert, or fix only the products that need round numbers. There is no fixed field for the base currency itself: its price is the WooCommerce field.

Set up fixed prices

  1. In WooCommerce → Settings → Currency, Currencies tab, check that the shop currency is marked in the Basic column. If the wrong currency is marked, the product screen offers fields for the wrong currencies.
  2. In the Advanced tab, set Is multiple allowed to Yes. Fixed prices only make sense when the customer pays in the selected currency, and the fixed price option is hidden and switched off while this is No.
  3. Turn on Individual fixed prices rules for each product and save.
  4. Open a product. In Product data → General, under the WooCommerce price fields, click The product fixed prices rules.
  5. Choose a currency in the drop-down and click Add, or click Add all for every currency at once. Each currency gets a Regular price and a Sale price field; an empty field shows auto, which means conversion by rate. Remove deletes the row.
  6. Update the product and check the price on the front end in each currency.

Type amounts with the decimal separator set in WooCommerce → Settings → General and without a thousands separator: 745920, not 745.920. FOX removes the WooCommerce thousands separator and reads the decimal separator, so a number typed in another locale's format is stored with the wrong magnitude: 745.92 instead of 745920, or 4550 instead of 45.50.

Variable products

Fixed prices are set per variation, not on the parent product. Expand a variation in Product data → Variations and the same The product fixed prices rules button appears at the bottom of its settings. Save the variations. The price range shown on the shop page is built from the variations' prices in the visitor's currency, fixed ones included.

Many products at once

Fixed prices are product meta named after the currency code: _woocs_regular_price_EUR and _woocs_sale_price_EUR, stored on the product or on each variation. An importer or a bulk editor that writes custom meta can therefore fill them for a whole catalogue; see bulk editing the fixed price fields and setting a fixed price programmatically. To read a fixed price in your own code, for a feed or a custom template:

/*
 * FOX: the fixed price of a product or variation in a currency,
 * or null when the field is empty and the price is converted by rate.
 * $type is 'regular' or 'sale'.
 * Child theme functions.php or a code snippets plugin.
 */
function my_fox_fixed_price( $product_id, $currency, $type = 'regular' ) {
    $value = (float) get_post_meta( $product_id, '_woocs_' . $type . '_price_' . strtoupper( $currency ), true );
    return $value > 0 ? $value : null;
}

// Example: my_fox_fixed_price( 123, 'EUR' ) returns 45.0, or null

An emptied field is stored as -1, which is why the function treats anything not above zero as "no fixed price".

Sale prices, taxes, rounding and discounts

  • Sales. When the product is on sale, FOX uses the currency's Sale price field. If that field is empty, the currency shows its fixed regular price without any discount: the base sale is not converted into it. When you run a sale, fill the sale field of every currency that has a fixed regular price.
  • Taxes. Fixed prices follow the same Prices entered with tax setting as your base prices. With prices entered including tax, WooCommerce still recalculates the gross amount for customers whose tax rate differs from the shop's base location, so a fixed 49.00 can show differently for such a customer. That is WooCommerce tax behaviour, controlled by its woocommerce_adjust_non_base_location_prices filter.
  • Rounding. Rounding snippets on woocs_raw_woocommerce_price also receive fixed prices. Rounding converted prices shows how to leave such currencies out.
  • Discount and pricing plugins. FOX replaces the price it receives with the fixed price, so a discount that another plugin applied before that point (dynamic pricing, quantity tiers, role or wholesale prices) is lost in currencies that have a fixed price. A plugin or snippet can apply its discount to the fixed price through the woocs_fixed_raw_woocommerce_price filter. Check the plugin's compatibility page on this site first.
  • Price filter. The WooCommerce price filter searches the base prices in the database and only shows the range converted by rate. A product whose fixed price is far from its converted price can fall on the wrong side of a filter range.

Coupons and shipping have their own per-currency amounts: Individual fixed amount for coupon and Individual fixed amount for shipping in the Advanced tab. For shipping, see shipping cost currency conversion.

Which product types support fixed prices

The fields are built for standard WooCommerce products. They appear for simple and external products, for every variation of a variable product, and for the types subscription, composite, bundle and box_product. Whether a fixed price is right in the cart depends on how the product type calculates its price:

  • Simple, external and variable products read the fixed price directly.
  • Bundles and composite products add up the prices of their items in their own code. A fixed price replaces the price of the container product, not the extension's calculation. Read the page for your extension: Product Bundles, Composite Products, YITH Product Bundles.
  • Bookings, gift cards, courses and other custom product types calculate prices their own way (from duration, from an amount the buyer chooses) and are converted by rate. They get no fixed fields.
  • Subscriptions: the fixed price becomes the recurring price, but on products with a sign-up fee it also replaces the first payment, so the fee is lost. Details in WooCommerce Subscriptions in multiple currencies.

To show the fields for another product type, add its slug with the woocs_product_fixed_price_data_simple_types filter. That makes the fields appear; it does not make the type use them. Test a real order in a second currency before relying on it.

Different prices by country

Fixed prices belong to currencies, not to countries. There are two ways to price by country:

  • Each country has its own currency. Set fixed prices per currency and map countries to currencies in the GeoIP tab: visitors from Switzerland open the shop in francs and see your franc price. The setup is in automatically change currency by country and WooCommerce price based on country.
  • Several countries share a currency but need different prices. Turn on Individual GeoIP rules for each product and use The product custom GeoIP rules on the product: you set a price for a group of countries, in the base currency, and it is converted by rate into whatever currency the visitor uses. A fixed price for the visitor's currency takes priority over it. Two different fixed prices in the same currency for two countries are not possible.

Fixed prices make one currency cheaper than another, and a visitor can switch to the cheaper one. Checkout by GeoIP rules in the Advanced tab makes customers pay in the currency of their country; see checkout currency based on customer country for how it works and its limits.

Fields missing, not saving or wrong

The button or the fields are missing

  • Is multiple allowed is No, or Individual fixed prices rules for each product is off.
  • The product type is not on the list above. On a variable product, look inside each variation.
  • The drop-down offers only some currencies: the base currency never appears, and currencies that already have a row are not offered again.
  • A JavaScript error from another plugin on the product edit screen keeps FOX's panel hidden, because the panel is shown by script. Open the browser console (F12) on the product screen, find the plugin named in the error and deactivate it to confirm. Currency codes that are not real ISO codes cause such errors too; see custom currency codes.

The values do not save

FOX saves fixed prices only for users with the manage_options capability, which by default only administrators have. A Shop Manager can see and type in the fields, but the values are silently dropped, and the screen keeps showing what was stored before. Save as an administrator, or give the capability only while a product is being saved:

/*
 * Let users who can edit products (Shop Manager) save FOX fixed prices.
 * manage_options is granted only during the product save actions.
 * Child theme functions.php or a code snippets plugin.
 */
add_filter( 'user_has_cap', function ( $allcaps, $caps, $args, $user ) {
    if ( in_array( 'manage_options', $caps, true ) && ! empty( $allcaps['edit_products'] ) ) {
        if ( doing_action( 'woocommerce_process_product_meta' )
            || doing_action( 'woocommerce_save_product_variation' )
            || doing_action( 'woocommerce_process_product_meta_variable' ) ) {
            $allcaps['manage_options'] = true;
        }
    }
    return $allcaps;
}, 10, 4 );

Other plugins that check manage_options while a product is saved also see the capability during those actions, so add this only if the Shop Manager role must manage prices.

The price is wrong on the front end

  • Check the stored value: the meta _woocs_regular_price_XXX on the product, or on the variation ID for variable products. A value a hundred or a thousand times off is the separator problem described in the setup.
  • The prices change a moment after the page loads, or the page source (Ctrl+U) shows other amounts than the screen: the page came from a cache, or the server did not know the visitor's currency. See currency switcher resets to default currency.
  • The fixed price is shown but the cart total differs: a discount, bundle or pricing plugin calculates the cart. Test with only WooCommerce and FOX active and a default theme, then turn the others back on one by one.

If the fixed price is still not used, open a topic on the FOX support forum with the product link, its type and the stored meta values, and we will look at it.