Getting slug of a product

<?php

global $product;

$slug=$product->post->post_name;

echo $slug;

?>