WordPress how to get current url woocommerce product

I am trying to get Woocommerce product permalink by given product name. I know I can get permalink by given product ID like this:

But I can not find any code to get it by product name. I tried this:

Or in the woocommerce template, you can follow the following snippets

Also published on Medium.

Leave a Reply

Notify of