Lyall
Lyall

Reputation: 1437

WooCommerce - add new subtotal and re-order fields in order emails

I have a client which requires the order confirmation/completion emails to include the 'PO subtotal' which is the amount they will actually pay (product subtotal + shipping cost). We would also like to move the 'payment method' to the bottom of the list, and rename some others.

For example, the section of the email currently looks like this:

enter image description here

But the client needs it to look like this:

enter image description here

I don't need to update the website front or back ends, only the emails, although it doesn't matter if it also updates the front end. Is this possible? Thanks.

Upvotes: 1

Views: 611

Answers (1)

Dan Wich
Dan Wich

Reputation: 4943

Would it be ok if it did update the display on the site as well? If so, the woocommerce_get_order_item_totals filter lets you re-arrange and add new rows there.

If not, you could:

  • Find a way of identifying whether that filter's being called in the context of the email(s) you're targeting. I think you can check each WC_Email's $sending for that.
  • Customize email-order-details.php to do what you want (copied into your theme, not editing the original).

Upvotes: 1

Related Questions