How to get product URL or URL alias using product ID? I'm using Drupal Commerce and stuck in this problem. I'm creating a custom module that will display a product title and some info. 

I want that product to be linked to its node page, and product Object is all I have to my resources. I'm thinking of getting the product URL or alias using product_id but I don't know how. I already searched it but there's nothing clear on the search results I got.

Any suggestions?
After trial and error I found a solution. Here's what I did.

        //$product is the product object that I mentioned above
        $wrapper = entity_metadata_wrapper('commerce_product', $product);
        $nodes   = $wrapper-&gt;field_product_node-&gt;value();
        $path    = drupal_get_path_alias("node/".$nodes[0]-&gt;nid);
        $product-&gt;path = $path;