Support » Plugin: WooCommerce » Adding Woocommerce shortcode in PHP to home page of other Theme

  • Ok any whizz kids want to help me, I have a non Wootheme I am using, which I have recently added woocommerce too, with some major CSS work I have managed to get it to work very well regarding products.

    However I would like to use a hook or shortcode in the PHP of the themes home page to show say 10 of all products

    I have tried many methods of php echo do_shortcode etc but it simply breaks the site, must be missing something

    I kind of understand the shortcode does reside in the main wordpress set up so maybe this is the problem

    But any clever chaps want to give me some pointers it would be appreciated

Viewing 6 replies - 1 through 6 (of 6 total)
  • Roy Ho


    WooCommerce shortcode is not dependent on a wootheme’s theme. So it will work on any theme as long as WooCommerce is installed.

    So I am not sure what exact issues you’re seeing. So perhaps elaborate on what you mean by “breaks the site”.

    Ok so I am going to home.php and under the last section of post I want to list certain product categories I am using the following

    <?php echo do_shortcode(“[product_category category=”gold-silver-courses” per_page=”12″ columns=”2″ orderby=”price” order=”desc”]”); ?>

    Roy Ho


    Again, you’re not stating how it breaks…Are you seeing errors messages? Are you seeing weird layouts? What?

    Oops sorry – no the page just goes white and nothing, the site stops working altogether

    Roy Ho


    Try this instead:

    <?php echo do_shortcode('[product_category category="gold-silver-courses" per_page="12" columns="2" orderby="price" order="desc"]'); ?>

    And post your URL, that always helps.

    Your a star!!! that worked perfectly should have spotted the ” ”

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding Woocommerce shortcode in PHP to home page of other Theme’ is closed to new replies.