Attempting to extract the shipping tracking number from the content of a Woocommerce note to customer to eventually pass to a custom field as a value
Original function
function get_value( $comment, $parameters ) {
return $comment->content;
}
Modified function (not working)
function get_value( $comment, $parameters ) {
$tracking_note = $comment->content;
$new_output = preg_replace( '/[^0-9]/', '', $tracking_note );
return $new_output->content;
}
preg_replace will not return an object, also refer to: https://www.php.net/manual/en/function.preg-replace.php.
Just return the variable like: return $new_output;