I am trying to display a suffix after the Price ONLY on the Product Page. I do not want to display this suffix anywhere else.
I am NOT using the Tax settings as my prices are all inclusive and I do not want to complicate the settings using the Tax options.
Using the first route from code snippet on this answer https://stackoverflow.com/a/57218980/8044005
My code is:
## Add suffix to price on Product Page
add_filter( 'woocommerce_get_price_html', 'custom_price_suffix', 100, 2 );
function custom_price_suffix( $price, $product ) {
if(is_singular('product')) {
$price = $price . ' <span class="make-me-small"> Inclusive of all taxes</span>';
}
return apply_filters( 'woocommerce_get_price', $price );
}
##-End of above code - Start new code below
However, this code snippet shows the suffix in the Related Products.
What changes should I do to prevent displaying the suffix in Related Products
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…