Template changes in WooCommerce 1.6

You are here:

With WooCommerce 1.6 now available, there are a couple of changes in the template system that make it more efficient and easier to customize than before. We also completely removed the use of the query_posts function, making queries executed in order to load pages more flexible.

Moved the main loops

The most important change is that we have moved the location of where the loops are actually started. In versions prior to WooCommerce 1.6, the loops were a part of a function, including other files. This made perfect sense for developer and users with more than average knowledge of code, but for the majority it was a maze of files and functions.

The main loops have now been moved back to archive-product.php and single-product.php.

New content parts in template files

With the new loops in place, we enabled easier override of specific parts of the templates. That is where we introduced content-product_cat.phpcontent-product.php and content-single-product.php. These files will be used in all archive or single pages of products, moving the way these parts look to the exact same files. In other words, you only have to make changes to one file to change how a product looks on all archives.

Removed parts of the older templates

Because we have so many new ways to work with and override the templates, some parts of the template became obsolete.

Removed template files

We stripped out a couple of template files: loop-product-cats.php and loop-shop.php.

Deprecated functions

Because of the new way the template system works, three functions have been stripped out:

  • woocommerce_single_product_content()
  • woocommerce_archive_product_content()
  • woocommerce_product_taxonomy_content()

These functions have no alternative available since they no longer have a use. The deprecated versions of these functions will call woocommerce_content() for now, providing reasonable backwards compatibility. You will not lose any functionality, but might want to polish up the looks of the files using these functions as there are better ways to do this available now.

Was this article helpful?
Dislike 0
Views: 16