I'm using Magento EE 2.2.5
I need to get the product url of a product with its category path.
Presently, I'm using the code
$product_url = $product->getUrlInStore();
And also tried with
$product_url = $product->getProductUrl();
I'm getting like: www.domain.com/product_url_key
But I need to get it like: www.domain.com/category_level_1/category_level_2/product_url_key
So is there any default function to get that?