WPDIR
Everything and everyone WordPress

Minimum theme files required for WooCommerce to function properly?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #599 Reply
    Billy
    Guest

    What is the fastest way to support WooCommerce in a WP theme I’m developing, will it just use the index.php if no Woo templates exist?

    #600 Reply
    Stephanie
    Guest

    Technically you can get away with only adding a snippet to functions.php if you want that defines your main content wrapper:

    WooCommerce Theme Developer Handbook

    remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
    remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);

    Then:

    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>';
    }
    #601 Reply
    James
    Guest

    If you prefer adding a theme file you can add woocommerce.php which is a catch-all file for Woo. Copy over your page template into a new file with that name and then replace the WordPress loop with the Woo loop which is:

    <?php woocommerce_content(); ?>

    And save.

    #602 Reply
    Lawrence
    Guest
    #650 Reply
    Jeffrey
    Guest

    If you’re going to use the “shortcut” methods mentioned on this thread it’s g
    fine and actually recommended, however be sure to learn how to customize WooCommerce CSS.

    Mastering the CSS can be more useful than generating dozens of theme files.

    #796 Reply
    Janice
    Guest

    Mastering the CSS

    ah yes that is chapter 3 in Mastering los Interwebz

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Minimum theme files required for WooCommerce to function properly?