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

Theming Snippets

Docs

  • 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 […]

WooCommerce

The most customizable ecommerce platform for building your online business.

  • 30-day money-back guarantee
  • Support teams across the world
  • Safe and secure online payment