Displaying a WooCommerce product via PHP

Use do_shortcode().

For example, in a template, if you were wanting to display products specifically by ID:

<?php

echo do_shortcode('[products ids="1, 2, 3, 4, 5"]');

?>

WooCommerce comes with several shortcodes which can be used to insert
content inside posts and pages: http://docs.woothemes.com/document/woocommerce-shortcodes/

You can add shortcodes to a post or page easily via the shortcode
shortcut button in the post editor: Woo Commerce Shortcode Editor

Leave a Comment