I have an online shop with WooCommerce. I want to show a custom price Suffix only on the Product List Page (like Shop Page), where all products are listed.
I have the following code:
add_filter( 'woocommerce_get_price_html', 'custom_price_suffix', 100, 2 );
function custom_price_suffix( $price, $product ){
$price = $price . ' Suffix ';
return apply_filters( 'woocommerce_get_price', $price );
}
But with this code, the suffix is display in the Product list Page and on single Products. Can anyone help me?
2
Answers
As mentioned in the comments you can use the
is_shop()
function to check if you are on the shop page like this:The following will show an additional custom price suffix on all product listings (except on single products):
Or you can also use:
Code goes in functions.php file of your active child theme (or active theme). Tested and works.