Learn how to set up, customize, and expand the functionality of your WooCommerce products with our library of documentation and tutorials.
  1. Documentation /
  2. Code Snippets /
  3. Theming Snippets

Theming Snippets


Documents

  • Query whether WooCommerce is activated

    If you’re building a theme which supports but doesn’t require WooCommerce, you may want to wrap WooCommerce functionality (think cart links etc) inside a conditional query. That way, if WooCommerce isn’t activated, the functionality is simply ignored instead of producing fatal errors. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears […]

  • Sample products loop

    This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters <ul class="products"> <?php $args = array( 'post_type' => 'product', 'posts_per_page' => 12 ); $loop = new […]

  • Show cart contents / total

    Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php file, as this will be wiped entirely when you update the theme. To display the cart contents and total […]

  • Show product categories in WooFramework breadcrumbs

    Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php file, as this will be wiped entirely when you update the theme. This file contains bidirectional Unicode text that […]

  • Display Category Image on Category Archive

    This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters /** * Display category image on category archive */ add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 ); function woocommerce_category_image() […]