Skip to content
Advertisement

PHP return value formatting

Could you please help me out how i would be able to customize the output of the below code which was added to wordpress/woocommerce?

Currently it shows the sales price and the regular price, and i’d like to add some customization for each of them, like: coloring (sales price=red); text-decoration (sales price=line-through)..

JavaScript

Thank you very much in advance for any help,

Advertisement

Answer

in your function you concating two strings in first condition, in second condition returned an empty string and in else statement returned that self price without change. so as your return type is string there is no problem for merging your prices with another strings such as html tags. if this process don’t make problem for another processes of your wordpress, you can use html tags by concating them in your returns:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement