woocommerce offtopic – Element „woocommerce_brand_detail“ shows double output

Question

Im using this code:

add_action( 'woocommerce_after_shop_loop' , 'woocommerce_brand_detail', 10 );

function woocommerce_brand_detail() {

    global $post;

    $brands = wp_get_post_terms( $post->ID, 'product_brand', array("fields" => "all") );

    foreach( $brands as $brand ) {
        echo __( 'Hersteller / Markenbeschreibung', '') . ': ' . term_description( $brand->term_id, 'product_brand' );
    }

}

To show on the end of every product list the description of each brand, if one is selected. it is working, but the problem: it shows double.. And i donw know why.

it Shows:

“Hersteller / Markenbeschreibung:
Description”
“Hersteller / Markenbeschreibung:
Description”

But it should be just:
“Hersteller / Markenbeschreibung:
Description”

0
Tom J Nowell 4 weeks 2023-01-09T11:16:38-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse