Hi @tuomvii,
Yes we have updated updated, some clients didn’t like old style with () so we replaced. But you can control this with filter:
add_filter('ppom_option_label', 'ppom_change_label', 11, 4);
function ppom_change_label($label, $option, $meta, $price){
$label = "{$option_label}(+{$price})";
return $label;
}
Thank you very much for this @nmedia! One simple question, does removing the plus sign affect the plugin somehow? Is it mandatory?
And for some reason when using that snippet, it doesn’t show the option labels “1 unit”, “3 units” etc.
-
This reply was modified 6 years, 5 months ago by
tuomvii.
Hi,
No won’t affect any calculation. And what do you mean by doesn’t show option label…
@nmedia, before the snippet it shows the options like this:
1 unit [+24,90 €]
3 units [+44,90 €]
5 units [+99,90 €]
When I use this snippet in the functions.php file:
add_filter('ppom_option_label', 'ppom_change_label', 11, 4);
function ppom_change_label($label, $option, $meta, $price){
$label = "{$option_label}({$price})";
return $label;
}
Notice that I removed the plus sign on purpose.
But after it show’s like this:
(24,90 €)
(44,90 €)
(99,90 €)
So the labels before the prices are removed and not showed.
Sorry, here is the correct code:
add_filter('ppom_option_label', 'ppom_change_label', 11, 4);
function ppom_change_label($label, $option, $meta, $price){
$option_label = $option['option'];
$label = "{$option_label}({$price})";
return $label;
}
@nmedia thank you very much for your response! This works beautifully now. Will be using your plugin in the future too. Nice support <3