[Resuelto] Function to check current product category 's parent
This support ticket is created hace 4 años, 8 meses. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
I'm developing a Woocommerce shop and need to display views conditionally, depending on the parent term of current product category archive page.
The shop has two main categories, Woman and Men.
For example, I need to show a view only if you are on woman's category archive page (this is ok using [wpv-taxonomy-archive]' eq 'Woman') OR if the current archive page parent is Woman. The same with man parent category. Also need to be hable to use the same function to check for future parent categories.
I know I have to use something like this [wpv-conditional if="( '[wpv-taxonomy-archive]' eq 'Woman' ) OR ( archive_term_parent_category() eq 'Woman' )"][/wpv-conditional] based on this post https://toolset.com/forums/topic/how-to-set-condition-on-filter-controls/ but need your help with the function to get current archive parent category, please.
You can use the shortcode like this [wp_parent_archive_title taxonomy="taxonomy-slug" term="term-slug"] where you will replace the taxonomy slug with the slug of your taxonomy and the term-slug with the slug of your term.
So in your case you can do this [wp_parent_archive_title taxonomy="taxonomy-slug" term="[wpv-taxonomy-slug]"]
"Finally just use replace taxonomy-slug with the slug of the taxonomy created in Types." The taxonomy is created by default by Woocommerce plugin I didn't create it with Types, just in case this is part of the problem.