Woocommerce customization – different templates for product category and page

Our task – to do the separate files of template for the category of commodity and for the page of commodity in a shop on a base woocommerce. Practical application – a category must have sidebar for a filter, and on the page of commodity he is not needed. How to realize it – we read farther.

We will consider variant of integration with the use of file of woocommerce.php described in previous material.

For this purpose this file needs to be changed, namely – to replace woocommerce _ content(); ?> on dividing into two files of template. In the total our file will assume a next air:

Whereupon actually we create in a root the folders of theme two files of templates of woocommerce – product.php and woocommerce – category.php with separate templates under our necessities.

It is now possible separately to govern file of template of category and template of page of commodity.

We will do as in an entry is a category with сайдбаром and commodity without:

content woocommerce-category.php:

content woocommerce-product.php:

This example with the minimum code – to the concept of logic of work of separation. You can experiment at your own pleasure and make almost any display for the category and product template.

Leave a Reply

Your email address will not be published. Required fields are marked *