Is it possible to get an ID
of a WooCommerce product only by knowing it's slug
? I need to fetch the product's price outside the product's page.
use the existing function get_page_by_path();
$product_obj = get_page_by_path( $slug, OBJECT, 'product' );
better explanation :
https://wordpress.stackexchange.com/questions/206886/get-product-details-by-url-key-in-wordpress-woocommerce
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With