Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

WooCommerce: Anatomy of a Template File


Published on

These slides belong to, a technical video course that shows you how to override WooCommerce pages and elements without using plugins. You can watch me code and learn by example.

A series of videos, screencasts, examples and exercises will help you feel more confident about WooCommerce customization, child themes, hooks and CSS/PHP snippets.

Watch and re-watch each video how many times you like, get lifetime access to me via the comment section, exercise as much as possible and keep learning.

Access your free videos or buy the course via

Published in: Internet
  • Be the first to comment

  • Be the first to like this

WooCommerce: Anatomy of a Template File

  1. 1. Getting Ready: Anatomy of a Template File
  2. 2. If You Want to Customize Woo... You need to understand how the frontend is “assembled” (hint: it’s made of several template files)
  3. 3. Anatomy of a WC template file ● ../templates/single-product.php
  4. 4. single-product.php lines 1-20
  5. 5. single-product.php lines 1-20 ● What the template does ● How to override (copy template to /woocommerce folder > “HOWEVER” section as this is not ideal) ● @version 1.6.4 (last time it was updated) ● Security: prevent direct access
  6. 6. single-product.php lines 21-39
  7. 7. single-product.php lines 21-39 ● get_header ● do_action( 'woocommerce_before_main_content' ) ● wc_get_template_part( 'content', 'single-product' ) which means “GET THE CONTENT-SINGLE-PRODUCT.PHP FILE”
  8. 8. single-product.php lines 40-61
  9. 9. single-product.php lines 40-61 ● do_action( 'woocommerce_after_main_content' ) ● do_action( 'woocommerce_sidebar' ) ● get_footer()
  10. 10. (content-single-product line 1-19)
  11. 11. (content-single-product line 20-43)
  12. 12. (content-single-product line 44-62)
  13. 13. (content-single-product line 63-76)
  14. 14. WooCommerce Plugin: ../templates ● Next: hook theory... ● But for now: remember that if you see “do_action” you can run your custom functions there WITHOUT overriding @ /woocommerce