I’m still beginner in PHP. I have a small problem, I would to multiply the value get_formatted_order_total();
with 3.75 and what I did is
get_formatted_order_total(); * 3.75
but It didn’t work.
here is the code
<li class="total">
<?php _e('Total:', 'woocommerce'); ?>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
Thank You
Semi-colons go at the end of an instruction. Since this is all one instruction, you need to move the semi-colon to the end of the line:
Example: http://codepad.org/HH3RLZCR
Try so
Without ; after ().
; should be after 3.75
The problem is, that
get_formatted_order_total()
returns a string, formatted for display on the website, not a numerical value that you can use for calculation.The unformatted value is available as a member variable of the Order class, so
should work.
In order to understand this, look at the source code of Woocommerce:
Order::get_formatted_order_total()
simply formatsOrder::order_total
with a helper functionwoocommerce_price()
: