How to Get WooCommerce Product ID from It's Slug?
10,066
use the existing function get_page_by_path();
$product_obj = get_page_by_path( $slug, OBJECT, 'product' );
better explanation :
Author by
Admin
Updated on June 19, 2022Comments
-
Admin almost 2 years
Is it possible to get an
ID
of a WooCommerce product only by knowing it'sslug
? I need to fetch the product's price outside the product's page.