How to get product image URL from product page?
I have found a quick fix for this issue.

$product = commerce_product_load($productId); // loads the product by id
$productImage = drupal_json_encode(file_create_url($product-&gt;field_images['und'][0]['uri'])); // gets the main image of the product if it has multiple images and formats the link properly