I have this kind of product CATEGORIES in WooCommerce
1- New Cars
2- Used Cars
3- Rental Cars
LAYOUTS:
1- New Cars Layout
2- Used Cars Layout
3- Rental Cars Layout
So i have 3 different Layouts for each Category
I would like to get the Layout displayed depending on the Category. If a product assigned to "New Cars Category" then i would like to show this product with "New Cars Layout"
I have found already a solution with GUI Condition
[wpv-conditional if="( has_term('newcarcat', 'product_cat', null) eq '1' )" ]
<div class="col-12 p-5 bg-success">
<p class="h3 p-2 text-center text-white"> THIS IS DETAILS ABOUT CAR FROM NEW CAR CATEGORY</p>
</div>
[/wpv-conditional]
[wpv-conditional if="( has_term('usedcarcat', 'product_cat', null) eq '1' )" ]
<div class="col-12 p-5 bg-dark">
<p class="h3 p-2 text-center text-white">THIS IS DETAILS ABOUT CAR FROM USED CAR CATEGORY</p>
</div>
[/wpv-conditional]
[wpv-conditional if="( has_term('rentalcarcat', 'product_cat', null) eq '1' )" ]
<div class="col-12 p-5 bg-danger">
<p class="h3 p-2 text-center text-white"> THIS IS DETAILS ABOUT CAR FROM RENTAL CAR CATEGORY</p>
</div>
[/wpv-conditional]
I can show/hide content on the front end depending on the category is chosen. But all this will be saved in only one layout.
Is it possible to make different Layouts for different products as i described ? even if code needed!
Hello. Thank you for contacting the Toolset support.
Well - The another link you shared which includes the example to use the filter get_layout_id_for_render is the correct filter to switch the layout.
Could you please tell me how you use that filter and how you are checking or what could be the flow to check your taxonomy terms?
If will be great if you can provide all required information with problem URL.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.