Skip Navigation

[Resolved] Thousand separator in Price Field

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 7 replies, has 1 voice.

Last updated by gregB-9 1 month ago.

Assisted by: Minesh.

Author
Posts
#2808624
firstcar thousand seperator 2.jpg
firstcars thousand seperator.jpg

Tell us what you are trying to do?
I want to add a Thousand Seperator to the price field using the "fields and text" shortcode.

Is there any documentation that you are following?
None

Is there a similar example that we can see?

What is the link to your site?
hidden link
hidden link
hidden link

#2808635

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

I would like to know first, how exactly the price stored in backend and what shortcode or block you are using to display it.

Can you please share screenshots that should help me to review all those settings.

#2808734
Post field for price.jpg
Fields and text display.jpg
Data Type.jpg

Thanks for the replay. I have used a custom post type to create a template for each vehicle. I created a custom field labeled as "Basic Info" to display information such as the description, featured image, gallery, price, mileage etc.

The price field is using the field type called "Number". I will share a screenshot for you.

To display the block I used the "Fields and Text" module provided by Toolset. Will provide more screenshots

#2808767

Minesh
Supporter

Languages: English (English )

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

Can you please share edit post screen screenshot where I can see the price field?

Also - please switch to HTML tab for "Fields and Text" block and send me screenshot.

#2808796
Price Field Value switched to HTML.jpg

I am sorry, can you please expand on "Can you please share edit post screen screenshot where I can see the price field?". I don't understand what you want to see?

I have changed the Fields and Text block to HTML (Please see screenshot). Here is also the code if you need it

<p>R[types field='price' format='FIELD_VALUE'][/types]</p>

#2808868

Minesh
Supporter

Languages: English (English )

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

Can you please try to add the following code to "Custom Code" section offered by Toolset:
=> https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/#benefits-of-adding-custom-code-using-toolset

add_shortcode( 'show_price', 'func_thousands_separator_for_price');
function func_thousands_separator_for_price( $atts, $content ) {
if($atts['price']!=0 or $atts['price']!='') {
  $price_value = $atts['price'];
  
  return number_format($price_value, 0);
}else{ 
   return 0; 
}
}

And within your "Fields and Text" block you can call the above shortcode as given under:

R[show_price price='[types field='price' output='raw'][/types]']
#2808881
Thousand seperator PHP code.jpg
Shortcode.jpg

Thanks for the code. I have added the PHP and the snippet but it does not want to save the change and also does not show it. I will send you screenshots

#2808893

Minesh
Supporter

Languages: English (English )

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

Can you please try to uncheck the checkbox "WordPress admin" and then try to save the code snippet and then try to save the content template/post/page and check if you able to see it working on frontend.
=> https://toolset.com/wp-content/uploads/2025/05/2808881-Thousand_seperator_PHP_code.jpg

#2809404

Hi Minesh. Thank you so much. You are a superstar. I managed to make it work with the code that you supplied.

I only had to use the native shortcode module from Gutenberg.

Thanks again for the help.