I have a question regarding woocommerce and the product-pages. I want to output the text and pictures stored in the product category.
For example, if the product is connected to the categories "electro" and "car", I want to output the text and pictures stored in the woocommerce-category description of "electro" and "cars".
I used the following code, to get at least some information displayed, thats stored in the functions.php
(like some text in the listitem
)
add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );
function my_extra_button_on_product_page($category) {
global $post;
echo '<ul class="myCat"> ';
if ( has_term( 'Cocktails', 'product_cat' ) ) {
echo'
Wird gerne genutz in Rezepten für:<br />
<li class="icon-glass2">1</li>
';}
elseif ( has_term( 'Dressings', 'product_cat' ) ) {
echo'
<li>2</li>
';}
if ( has_term( 'Limonaden', 'product_cat' ) ) {
echo'
<li class="icon-glass2">3</li>
';}
elseif ( has_term( 'Kochen', 'product_cat' ) ) {
echo'
<li class="icon-glass2">4</li>
';}
elseif ( has_term( 'Backen', 'product_cat' ) ) {
echo'
<i class="icon-glass2">5</i>
';}
elseif (has_term ('shrub', 'product_cat')){echo 'shrub';}
else {
echo 'test';
}echo '</ul><br style="clear:both;" /> ';}
There is however some code I found, but I dont know how to get it working with my code.
add_action( 'woocommerce_after_subcategory_title', 'custom_add_product_description', 12);
function custom_add_product_description ($category) {
$cat_id = $category->term_id;
$prod_term = get_term($cat_id,'product_cat');
$description= $prod_term->description;
echo '<div>'.$description.'</div>';
}
I would be happy, if someone could help me putting those together.