The Currency Switcher stores product prices in post meta table. They can be manipulated by using the standard update_post_meta() and get_post_meta() functions. 


Meta keys

  • _regular_currency_prices
    Regular prices for a simple prod
    uct, in JSON format.
  • _sale_currency_prices
    Sale prices for a simple product, in JSON format.
  • variable_regular_currency_prices
    Regular prices for a variation, in JSON format.
  • variable_sale_currency_prices
    Sale prices for a variation, in JSON format.
  • _product_base_currency
    Product base currency, three character currency code (e.g. EUR).


Meta keys (subscriptions)

  • _subscription_signup_fee_currency_prices
    Signup fees for simple subscription, in JSON format.
  • _subscription_variation_signup_fee_currency_prices
    Signup fees for variable subscription's variation, in JSON format.

Data format
The prices of a product are stored in a single metadata field. The prices are stored as a JSON string, as in the example below:  
{ "EUR": "123", "GBP": "456", "USD": "789" }

Important

This is the correct format, expected by the Currency Switcher. If you use any import plugin, make sure that it stores the JSON structure as is, without further processing. Some plugins parse JSON structures when they find them in a CSV file, and convert them to serialised PHP arrays. Our plugin does not expect such serialised array format, and might show a warning when it tries to load the prices. If you encounter such issue, you should re-import the prices in the correct format.


Below are some examples of how the prices could be stored in the CSV file to prevent the import plugin from converting them (it can be described as an escaped JSON string). Please note that these formats are provided just as a reference, and you might have to alter them to work with the import plugin you use.   

// This format should work with the product import/export feature provided by WooCommerce
{ "EUR": "123", "GBP": "456", "USD": "789" }

// The following format can prevent 3rd party CSV Import plugins from
// changing the original JSON format to a serialised array, which would
// trigger the warning
"{ \"EUR\": \"123\", \"GBP\": \"456\", \"USD\": \"789\" }"
\{ "EUR": "123", "GBP": "456", "USD": "789" \}
\{ "EUR": "123", "GBP": "456", "USD": "789" }


If you would rather enter the prices manually, simply empty the field in the database. The Currency Switcher will assume that there are no currency prices, and the error message will disappear. You will then be able to enter the prices manually, in the Product Edit page.


You can purchase the Currency Switcher from our online shop.