I would use get_permalink()
for the current page url if it is a “post” https://developer.wordpress.org/reference/functions/get_permalink/ it’s generally better to use WP functions for this.
The url safe name is something that you’re going to need to work out. It could be as simple as
$slug = url_encode($product_name);
or anything that renders the name in a way that works as a url value.