Created
June 11, 2019 23:48
-
-
Save KeylorCR/84a25bf0fcb082299f809ea8f133b48c to your computer and use it in GitHub Desktop.
Adding superscript to wc_price filter <sup></sup>. Working to all prices throughout the site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
** Adding superscript to wc_price <sup></sup> | |
** not working with prices into select2 | |
**/ | |
function custom_custom_price_format($return, $price, $args, $unformatted_price) { | |
$elements = explode('.', $price); | |
if(is_admin()) { | |
return $return; | |
} else { | |
return sprintf( '<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">%s</span>%s<sup>%s</sup></span>', get_woocommerce_currency_symbol(), $elements[0], $elements[1] ); | |
} | |
} | |
add_filter('wc_price', 'custom_custom_price_format', 10, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment