WooCommerce Views makes it possible to build custom WooCommerce sites with Views. You will be able to create product lists, design product templates and build custom searches for products.
The best way to learn how to customize WooCommerce is by doing it yourself. We offer a free course that will teach how to customize your WooCommerce site with the Toolset plugins.
Go to Toolset->WooCommerce Views for initial setup.
Below we explain what each section is about.
The WooCommerce plugin comes with its own template for a single-product page. This template determines what product information will appear on your product page. If you plan to redesign this single-product page with the Views plugin first you need to switch off the default WooCommerce single-product template. This is done in the “Product Template File” section.
The last option – “WooCommerce Views plugin default single product template” – is frequently used. After switching to this one, your single product page will show only the content part of your post. Then you can easily replace it creating your own Content Template.
The product fields that WooCommerce outputs will display correctly if the entire product is wrapped in a DIV with the correct classes (see the picture).
WooCommerce Views helps you by setting the required classes for the Content Template. This is done in the “WooCommerce Styling” section.
If you are not familiar with the WooCommerce classes magic, it’s best to leave the checkbox selected. If you want to set the WooCommerce classes yourself, uncheck it.
The following pictures show a WooCommerce Single-Product page with and without this option checked.
In order to create custom searches for products, you need to have static fields in the database for product price and other product attributes.
WooCommerce uses a combination of different fields to store such values. For example, the product price is a result of the ‘price’ field, ‘sale price’ field, ‘on sale’ indication, ‘sale’ period, current date, etc.
Running a database query on so many items would be extremely inefficient and would not allow creating custom searches for large shops.
WooCommerce Views resolves this problem by calculating ‘static’ fields for these dynamic values:
- views_woo_in_stock – a custom field that determines whether the product stock is available
- views_woo_in_sale – a custom field that determines whether the product is on sale
- views_woo_in_price -a custom field that stores the price
You can see the fields defined in the Types plugin (Toolset->Post Fields).
These the dynamic values may change, the ‘static’ fields need to be recalculated periodically.
You can enable automatic scheduling for this recalculation, or do it manually. This is done in the “Static Product Fields for Custom Searches” section.
Please note that these static fields for product values are only necessary if you intend to build custom searches for products and if you want to base the searches on values that come from combinations of fields. If you are not using sales prices, you can safely use the ‘normal’ WooCommerce price fields for custom searches.
Please note that the WooCommerce Views plugin will automatically update the static fields whenever a user edits/saves the product from the WordPress admin.
The recalculating is necessary when there are large amounts of products to be updated at the same, for example when a user imports new products from other databases or there is a mass product update takes place.
Read more in the WooCommerce Views – Calculated fields and batch update documentation.