How to get product URL or URL alias using product ID?
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;