How to Get WooCommerce Product Title

Get WooCommerce Product TitleWhen you are customizing WooCommerce single product page you may want to get WooCommerce Product Title. There are several ways you can get the product title in WooCommerce but the best way is using the product ID.

If you want to learn more about product ID in WooCommerce you can check my previous tutorial on how to get Product ID in WooCommerce.

If you are looking for the WooCommerce product ID on the checkout page, my other tutorial on how to get product ID on checkout page may be helpful.

Get WooCommerce Product Title

As I mentioned above, you get the product title you need to use the product ID assuming the product ID is 100 you can use the code below to get the product title.

$product_id = 100; // Set the product ID 

$_product = wc_get_product($product_id); // Get the product 

echo $_product->get_name(); // Display the product title  

You can now use this code across your theme or plugin in instances where you want to get the product title and display it. You can also get the product ID dynamically and apply it to the code to get the product it.

Similar Articles