Decimal stripped from metabox number

So you want to be doing something like this instead…

$price = number_format($price_meta, 2);
echo $price;

The significant part here is the 2, it will add the 2 zeros after the . if you wanted it to not show the zeros you would set this as 0 – No need to be adding in dots and what not yourself when it is done for you!

Hope that helps 🙂

***** UPDATE *****

So after you updated your code to show where / how it is being updated, it is not any clearer unfortunately. I want to agree with @Mark, there are a lot of things along the way that could be causing this.

You also removed the first bit of code which wasn’t too helpful :/

From looking at that, plus what you’ve added, I would start by removing this;

$price_meta= preg_replace('/[\$,]/', '', $price_meta);

You are updating correctly by the looks of it using;

update_post_meta($post_id, '_ct_price', esc_attr(strip_tags($_POST['customMetaPrice'])));

You should be echoing it the way I showed above;

$price = number_format($price_meta, 2);
echo $price;

I have just tested this out and it works perfectly, I am also doing it on my own system using AJAX, it also works perfectly like that too.

Check it here – https://cl.ly/0u2v2P1a112t

Without more detail it will be difficult to debug.