I am writing a function to insert code in the header of the thank you page by adding a function to wp_head in functions.php of the template. I require to get the order_total_value to finish my job, but after searching for days I can’t find a clue how the get this value.
It works when adding the code to the woocommerce_thankyou function but there are big issues with it. The main one is that WordPress messes up my code when sending it to the browser (http://core.trac.wordpress.org/ticket/3670). The only way would be to disable this core function by commenting it out, but this is not what I am looking for. I want my code to be able to survive WordPress upgrades.
I can get the value without problems when editing the templates, but it seems impossible when adding a function to wp_head. For some reason order details are not stored in the global variables.
Is there a way to get the total order value?
- The topic ‘how to retrieve order details for wp_head?’ is closed to new replies.