- Messages
- 2
- Likes
- 0
- Points
- 1
Alright so I have this custom php code in my woocommerce order-details.php template file. It works fine. So I decided this will be a pain in the ass every time I want to change the freebies out. So I added it to woody. Then I added this to my order-details.php file:
So now when the email gets sent it errors out with a floatVal of 0 everytime. I wanted to try it a different way like removing the html_entity_decode and adding $ to my pattern to see if that works better but adding $ immediately converts it into a dollar sign and thus doesn't strip the code correctly and errors out with a float of 0 as well.
Any help with this is most appreciated I'm still new with php and am having troubles with this.
Heres my Woody PHP Code Snippet:
PHP:
<div style="font-size: 18px; font-weight: bold;"><?php echo do_shortcode('[wbcr_php_snippet id="2850"]'); ?></div>
Any help with this is most appreciated I'm still new with php and am having troubles with this.
Heres my Woody PHP Code Snippet:
PHP:
$totalVal = preg_replace('/[^0-9.]/u', '', html_entity_decode($total['value']));
if ($totalVal > 0 && $totalVal <= 99.99 ){
echo 'For Spending $' . $totalVal . ' you have earned your self a free Blah';
} elseif ($totalVal >= 100 && $totalVal <=149.99 ){
echo 'For Spending $' . $totalVal . ' you have earned your self a free Blah' ;
} elseif ($totalVal >= 150){
echo 'For Spending $' . $totalVal . ' you have earned your self a free blah' ;
} else {
echo 'Error! Please notify site administration about this error!';
var_dump($totalVal);
}