Skip Navigation

[Resolved] currency values

This thread is resolved. Here is a description of the problem and solution.

Problem: How should I save and display currency values effectively?

Solution:
Enter numbers using "point" for decimals. Commas are not currently supported here.

1.00
10.99
1000.00
...and so on...

Sorting works automatically when numbers are entered in this format. Filtering numbers with decimals effectively requires a small code change. This code change is described here:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_custom_field_filter_type
Click "+ More" to see an example.

To show the currency, hard-code it into the display of a field. The currency type does not get stored in the database with the value, so sorting and filtering continues to work as expected. Example:

€[wpv-post-field name="my-price-slug"]
$[wpv-post-field name="my-budget-slug"]

In the field description for each custom field, you can add a note that tells the user which currency should be used. This will show up in the admin editor area for your post.
Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_custom_field_filter_type

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Franco Calcagni 6 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#524747

I am trying to: how can we display the currency? What type of field is necessary and is it possible to create a different currency depending on certain fields (i.e. price shall be in EURO and budget shall be in USD) ? How to display points and commas in the fields escaping them when ordering the fields?

I visited this URL:

I expected to see:

Instead, I got:

#524762
Screen Shot 2017-05-16 at 9.24.57 AM.png
Screen Shot 2017-05-16 at 9.24.14 AM.png

Hi, when saving values for custom fields, enter numbers using "point" for decimals. Commas are not currently supported here.

1.00
10.99
1000.00
...and so on...

Sorting works automatically when numbers are entered in this format. Filtering numbers with decimals effectively requires a small code change. This code change is described here:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_custom_field_filter_type
Click "+ More" to see an example.

To show the currency, I would simply hard-code it into the display of a field. The currency type does not get stored in the database with the value, so sorting and filtering continues to work as expected. Example:

€[wpv-post-field name="my-price-slug"]
$[wpv-post-field name="my-budget-slug"]

In the field description for each custom field, you can add a note that tells the user which currency should be used. This will show up in the admin editor area for your post. See the attached screenshot for an example.

#525856

thanks 🙂
Franco

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.