Using WooCommerce shortcodes

Yesterday I had some issues running WooCommerce shortcodes and didn’t found solution on YouTube or via Google. After an hour I figured it out. I created a post with the following shortcode:

[product_category category="letne-pneumatiky" order="asc"]

After viewing the post in the frontend a saw nothing with the following in single.php

// Start the Loop.
while ( have_posts() ) : the_post();

get_template_part( ‘content’, get_post_format() );


As I made my own theme and copied this loop code from the default twentyfourteen it didn’t show anything. I think the problem could be that I have no content.php and also
get_post_format() didn’t output anything. During googling I found get_the_content() which outputed the raw content, not interpreted shortcode. So I came to do_shortcode()
Joining the knowledge success arise
echo do_shortcode( get_the_content() );
But I thought that’s not nice, there must be a different, nicer WordPress solution.
After some digging in the themes directory I found the solution.

if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();



For a list of usable WooCommerce shortcodes visit


Author: Michal Zuber

Full stack developer, biker and rollerblader. Owner and developer at Co-founded Blog at

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s