/**
* Add shortcode for product type
*/
function displayProductType() {
global $product;
$product_id = $product->get_id(); // The product ID
return get_the_term_list( $product_id, 'product_type');
}
add_shortcode('product_type', 'displayProductType');
And then display in Views:
[product_type id='[wpv-post-id]']
I'm not sure this is right way of doing it but seems to work. Any comments?
Given that this is a custom shortcode. It needs to be added to the views 3rd party shortcode arguments in Toolset -> Settings -> Frontend . Once you add the name of the shortcode here then it should start working in our conditional output.
Also since you are using the global $product variable then you don't need to pass the [wpv-post-id] shortcode into the function since your shortcode does not take a parameter.
Please let me know if this has been helpful so far or if there are any concerns or questions.
Could you add debug='true' to the conditional shortcode. Like this -> [wpv-conditional if="( '[product_type]' eq 'auction' )" debug=true'']<p>[wpv-post-author]</p>[/wpv-conditional]
Then check on the frontend and send me a screenshot of the returned debug statement.
I tried [wpv-conditional if="( '[product_type]' eq 'auction' )" debug="true"]<p>Myyjä: [wpv-post-author]</p>[/wpv-conditional] but it doesn't give debug info. Just blank screen where the output should be.
Is it possible for me to log in and check this ? It would be much faster if I could have a look and then see if I can get a better understanding of whats wrong.
Given that the shortcode returns results in a view then it should work normally.