Skip Navigation

[Resolved] Updated instruction on how to format money for USD

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 1 year, 11 months ago.

Assisted by: Minesh.

Author
Posts
#2496515

Tell us what you are trying to do?
Display money as formatted.

Is there any documentation that you are following?
I've previously used the information here:
//* See: https://toolset.com/forums/topic/transforming-content-in-number-field-as-price/#post-611859

Which recommended the following be added to the child theme's functions.php file.
add_shortcode('format_money', 'sk_format_money');
function sk_format_money( $atts ) {
extract( shortcode_atts( array( 'price' => '0' ), $atts ) );
// $money = number_format( ( float )$price, 2, '.', ',' ); // if you want to show cents
$money = number_format( $price );
return $money;

The above has been depreciated and is now throwing an error.
Can you provide an updated solution?

Thank you.

#2496529

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share what error you see and how exactly you are calling the shortcode?

Maybe better if you can share problem URL where you are trying to display the formatted price/money and admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.