Trying to get Product Data on custom Template By product ID, right now i have this code to get Product Title.
$productId = 164;
echo $p_title = get_the_title( $productId );
looking for Short Description, Price, Product Image, Product Url, Product Brand. Or might be loop will be better but that loop should work with product static ID.
Thanks in advance.
You would probably be better served by creating a new product object.
Note, that the short description is merely the post's
post_excerpt
. If using outside of the loop (where$post
is automatically defined) then you would need to get the post directly.or alternatively, if you've already defined the product object you could do
since the WooCommerce product class will automatically define the
$product->post
property withget_post()
.apply_filters()
means that functions can be attached at this point to modify the content of$product->post->post_content
. At a minimum, I know thatwpautop()
is attached to thewoocommerce_short_description
filter to create paragraph breaks.