i am very new wooCommerce and WordPress. programming knowledge not strong yet. but for my project i need to do something. now i want to create custom short code for woocommerce product.

i want to show product by id or sku. woocommerce built-in shortcodes have and it is working fine which is https://docs.woothemes.com/document/woocommerce-shortcodes/ but example [product id="99"] but if use this shortcodes then it come with add to cart price etc information. mean template take for product. but i want to show only thumbnail picture and name and link. how can i do that ? can do anything in function.php for this. or create separate shortcodes for this.

would you guys help me out . how can i do that.


closed as off-topic by Mark Kaplun, cjbj, Dave Romsey, cybmeta, Howdy_McGee Oct 3 '16 at 16:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.


Hello Here is the Shortcode you can use this it will give you title link and image of product. Put this code in functions.php file of your theme.

function custom_product_function($atts)
    $post_id = $atts['id'];
    $title = get_the_title($post_id);
    $link = get_the_permalink($post_id);
    $image = get_the_post_thumbnail($post_id);
    $data ='<div><a href="'.$link.'"><p>'.$title.'</p></a>'.
    return $data;

And then add the shortcode in your page or post with product id

[product_data id=1958]

Not the answer you're looking for? Browse other questions tagged or ask your own question.