The following will show an additional custom price suffix on all product listings (except on single products):
add_filter( 'woocommerce_get_price_suffix', 'additional_price_suffix', 999, 4 );
function additional_price_suffix( $html, $product, $price, $qty ){
global $woocommerce_loop;
// Not on single products
if ( ( is_product() && isset($woocommerce_loop['name']) && ! empty($woocommerce_loop['name']) ) || ! is_product() ) {
$html .= ' ' . __('Suffix');
}
return $html;
}
Or you can also use:
add_filter( 'woocommerce_get_price_html', 'additional_price_suffix', 100, 2 );
function additional_price_suffix( $price, $product ){
global $woocommerce_loop;
// Not on single products
if ( ( is_product() && isset($woocommerce_loop['name']) && ! empty($woocommerce_loop['name']) ) || ! is_product() ) {
$price .= ' ' . __('Suffix');
}
return $price;
}
Code goes in functions.php file of your active child theme (or active theme). Tested and works.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…