Попробуйте:
public function wpd_payment_method_title($title, $id) {
if (!is_checkout() && !( defined('DOING_AJAX') && DOING_AJAX )) {
return $title;
}
$settings = get_option('woo_payment_discounts_setting');
$settings = maybe_unserialize($settings);
if (isset($settings[$id]['amount']) && 0 < $settings[$id]['amount']) {
$discount = $settings[$id]['amount'];
if ($settings[$id]['type'] == 'percentage') {
$value = $discount . '<span style="color:green;">' . __('% discount', 'woo-payment-discounts') . '</span>';
} else {
$value = wc_price($discount);
}
$title .= ' <small>(' . sprintf(__('%s', 'woo-payment-discounts'), $value) . ')</small>';
}
return $title;
}
Это должно сработать.
Если вы хотите, чтобы процентное значение скидки также отображалось зеленым цветом, вы будете использовать его вместо:
$value = '<span style="color:green;">' . $discount . __('% discount', 'woo-payment-discounts') . '</span>';
Или вы можете добавить класс:
$value = '<span class="discount-color">' . $discount . __('% discount', 'woo-payment-discounts') . '</span>';
И в файле styles.ccs
вашей темы вы добавите следующее правило:
.discount-color {
color:green;
}