I’ve added the text “kg*” after the price on the product page. However, it also adds the additional text to the price of the Related Products below. How do I exclude the price being added to the Related Products? I want to add the text only to the price of the product.
add_filter( 'woocommerce_get_price_html', 'hellblau_kg_nach_preis', 100, 2 );
function hellblau_kg_nach_preis($price){
if( is_single() ) {
global $product;
$weight = $product->get_weight();
return $price . ' / ' . $weight . ' kg*';
}
return $price;
}
I’ve tried several things like if( is_single() && ! RELATED-PRODUCTS ) without success.