1

I have a custom Wordpress theme I'm doing for a client and I need to make it woo-commerce compatible.

I've followed the steps on the woocommerce docs which are:

1) create a woocommerce.php file

2) copy in my standard page.php file and replace the loop with <?php woocommerce_content(); ?>

3) Add the following to my functions.php file:

// WOO COMMERCE COMPATIBILITY
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);

function my_theme_wrapper_start() {
  echo '<section id="main">';
}

function my_theme_wrapper_end() {
  echo '</section>';
}

However it isn't working. I'm just getting the standard loop still with random data pulled in and the word 'shop' added (image attached). This is actually what also happens when I don't do any of the above, but just activate woocommerce, so basically nothing changes.

I've starting to think is there some sort of standard shortcode function I need to add to my functions.php, to allow all shortcodes to work, because it looks like it's not pulling in the shortcode into the page? I've attached an image of what I'm seeing.

It's on a localhost site so I can't provide a link.

Any ideas / suggestions very welcome.

closed as off-topic by Michael, Mark Kaplun, Krzysiek Dróżdż, Nathan Johnson, Dave Romsey Apr 2 '18 at 22: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.

3

You'll need to declare support for WooCommerce in your themes functions.php file:

function mytheme_add_woocommerce_support() {
    add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );

Hope this helps!

  • Thanks Matthew that did solve it. It's a shame the question got down-voted :( – Paul12_ Apr 9 '18 at 23:44

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