I currently have the following code:
add_action('update_post_meta','dbp_wc_price_update_meta',10,4);
function dbp_wc_price_update_meta($meta_id, $post_id, $meta_key, $meta_value){
if( in_array($meta_key,array('_price','_price_var') ) ){
$meta_value = str_replace(',','.',$meta_value);
}
return $meta_value;
}
I want to make sure that there are no commas in the meta_value before it is saved. But with the hook and function above it is just saved as it is.
When I save 5,95 it still is saved as 5,95, but I want it to be saved as 5.95.