Toolset allows you to set conditions under which Content Templates display for certain posts.
Let’s say you have a WooCommerce store for selling shoes and you have product categories for “Trainers” and “Heels”. You can assign a different template to display single trainer shoes and another one for heels shoes.
Template for displaying shoes in the “Trainer” category
Template for displaying shoes in the “Heels” category
- Create a new Content Template or edit an existing one.
- Under the Usage section in the right sidebar, make sure the template is assigned to a post type.
- Click the Set conditions link next to the post type’s name.
- Set your conditions using the dropdown menus in a pop-up dialog that appears. You can select conditions based on the available fields and taxonomies for the selected post type.
- When done setting up the condition(s) click the Accept button.
Sometimes, you might conditionally assign multiple templates to the same content. In this case, you need to set the template’s priority:
- Expand the Priority section in the right sidebar.
- Use the Template Priority field to set the desired priority for the conditional template. Higher number means higher priority.
You can set up the conditions based on the stock status of a product. Currently, you need to manually enter the value you want to check against.
Use the following values when setting up conditions based on stock status:
- instock – is true when the product is in stock
- outofstock – is true when the product is out of stock
- onbackorder – is true when the product is on backorder
For stock status to work, you need to manually enable the stock management option for all relevant products.
- Styling Single-post Templates
- How to Display WooCommerce Orders on the Front-end
- Using the WooCommerce Subscriptions plugin with Toolset
- Display Dynamic Sources Inside all Text Blocks
- YouTube Videos with Advanced Options
- Using WooCommerce Fields in Product Forms
- Adding Toolset Blocks to the WooCommerce My Account Page
- Selecting WooCommerce Blocks Output Type
- Creating a Custom List of WooCommerce Products for a Taxonomy
- Building a Custom WooCommerce Shop Page
- Creating a Page with a Custom WooCommerce Product Search
- Creating a Custom List of Related WooCommerce Products
- Creating Custom Templates for WooCommerce Products
- Adding a Custom Taxonomy to WooCommerce Products
- Displaying Form Data
- Creating a Custom WooCommerce Product Slider
- Adding Custom Fields to WooCommerce products
- Creating Front-end Forms for Adding WooCommerce Products
- Creating templates to display members-only content
- Charge users for registering premium accounts
- Creating and Displaying Repeatable Field Groups
- Charge users for submitting content
- Displaying a Map on A Single Post Template
- Creating Templates to Display Custom Posts
- Creating Responsive Columns and Grids
- Display Content Conditionally
- Custom WooCommerce Roles and Admin Capabilities