Search code examples
wordpresswoocommercehook-woocommerce

Total price hook or variable in Woocommerce Email


How can I add total price in Email order heading like {order_number}?

Email Setting

Customer Email Template


Solution

  • You can use woocommerce_email_heading_(id) filter to do that.

    Here (id) is email template id e.g.: new_order, customer_processing_order, etc

    This filter provides 3 @param 1: formatted title 2. order object 3. email object

    you can get the total price from the order object and then replace it with your placeholder.

    Note: Make sure you validate the order object with is_a( $order, 'WC_Order' ) then after applying you replace the logic.