I want to be able to display a product title by using PHP to echo the product name by the product ID (this is to be displayed within a Page, not the product page itself). I am using WordPress and I have a plugin for PHP so I can include PHP code using [php]echo 'example';[/php]
One product example is; http://ukcctvinstallations.co.uk/product/1-camera-residential-system-hi-res/
When I edit the product, you can see in the URL that the ‘Post’ = 129 so am I right in saying this is the product ID?
If anyone has a solution for this, that would be much appreciated. I am using WooCommerce.
Assuming you get the product as an object
(WC version 2.5.2)
Found a solution:-
echo get_the_title( 'ID' );
Take a look here:
http://docs.woothemes.com/wc-apidocs/package-WooCommerce.Functions.Product.html
2017 – 2020 – Since WooCommerce 3, use the
WC_Product
methodget_name()
On cart items:
On Order items: