Tell us what you are trying to do? I am wanting to be able to show a products primary category assigned dynamically for a template page. For most of my template pages I am able to use Toolset's shortcodes to call custom fields or other parts of the post metadata.
I am wanting to get a Products Primary category to display on the page. Right now I can use the shortcode [wpv-post-taxonomy type="product_cat" format="name"], but this only works if one category is selected. If a product has mutliple categories the shortcode will display all categories.
I came across a topic discussing yoast_SEO primary filter, but I was unsure if this is what I could use or if it would work for my case.
https://toolset.com/forums/topic/using-main-category-as-filter-in-views/
Hello,
How do you setup the "products primary category"? If it is using "Yoast SEO" plugin, you can display the primary category ID with shortcode:
[wpv-post-field name="_yoast_wpseo_primary_product_cat"]
Pass above shortcode as attribute of below taxonomy view:
- Query Taxonomy Product categories
- Filter by:
Terms with ID set by the shortcode attribute
See screenshot term-id-filter.JPG
Display above taxonomy view's shortcode like this:
[wpv-view name="My amazing custom post list" term='[wpv-post-field name="_yoast_wpseo_primary_product_cat"]']