I'm trying to check the output of a variable in my functions.php file that runs after a new woocommerce order. The code will get the order time from a new order and store it in a variable for me to use elsewhere the code being:
$meeting_time = wc_get_order_item_meta($order_id, 'Time');
print_r($meeting_time);
I've tried a few ways to print the information:
- print_r
- javascript popup box
- writing to error log
but I can't seem to get any of these to work as my php knowledge isn't very good.
I want to be able to see the output of the variable to make sure it's returning what I want.
Is anyone able to assist me?
Please and thankyou.
print_r
output won't be visible if$meeting_time
isfalse
or an empty string, you should surround it with something e.g.print_r( 'meetingtime: "'.$meeting_time.'"' )
– Tom J Nowell♦ Dec 19 '16 at 0:59error_log
or a PHP debugger would do the trick, but you're not longer doing WP specific things at that point, you're doing general PHP things and would be better asking on Stack Overflow – Tom J Nowell♦ Dec 19 '16 at 12:27