Skip Navigation

[Closed] Add Currency to number field

This support ticket is created 4 years, 4 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 2 replies, has 3 voices.

Last updated by SteBlood 4 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#1736615

Tell us what you are trying to do?
Trying to add currency field to a number field.

The example I followed worked except Im not sure what to replace in the example short code:
[format-currency num='types-shortcode here' sym='$']

My Post type is lm-event-calendar
and the field is event-cost

Im using Elementor for the layout so Im using a shortcode widget to insert the example shortcode above

Is there any documentation that you are following?

https://toolset.com/forums/topic/display-numeric-value-as-currency/

Is there a similar example that we can see?

What is the link to your site?

#1737319

Hello and thank you for contacting the Toolset support.

To better assist your, I would like to access your backend area and check this closley. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

Please provide more details about your use case and the Toolset elements(template/view/archive) involved?

#1737883
s3.png
s2.png
s1.png

Hi Waldo,

I did this;

Add this to your custom code in Toolset Settings (Screenshot 1)

function format_money( $atts ) {
    extract( shortcode_atts( array(
        'price' => '0'), $atts) );
    return $price = number_format($price, 2, '.', ',');
}
add_shortcode('format_money', 'format_money');

Use this shortcode for the output within a text editor within Elementor; (Screenshot 2+3)

£[format_money price=[types field='price' output='raw'][/types]][/format_money]

I hope this helps

The topic ‘[Closed] Add Currency to number field’ is closed to new replies.