This file contains hidden or 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 | |
add_filter( 'woocommerce_get_price_html', 'wpa83367_price_html', 100, 2 ); | |
function wpa83367_price_html( $price, $product ){ | |
preg_match_all('!\d+\,*\d*!', $price, $prices); | |
$discount = ''; | |
if(isset($prices[0]) && !empty($prices[0])){ | |
if(count($prices[0])==2){ //There's total and discount prices | |
$total_price = floatval(str_replace(',', '.', $prices[0][0])); | |
$discount_price = floatval(str_replace(',', '.', $prices[0][1])); | |
$discount_amount = $total_price - $discount_price; |
This file contains hidden or 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 | |
preg_match_all('!\d+\,*\d*!', $price, $matches); | |
?> |
This file contains hidden or 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
window.debugMode = document.location.hash.match(/debug/) and console? console.log 'This is the first of many debug-mode outputs' if debugMode |
NewerOlder