Answers.Body: <p>Should be pretty doable with a small plugin.</p>
  
  <p>You'd want to listen to something like the <a href="https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete" rel="nofollow noreferrer">onOrderComplete</a> event, then loop through the line items making note of which product types the line items belong to, adding email address to an array to send to.</p>
  
  <p>Then at the end, you can loop through your email address sending the appropriate emails out to each of the users.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-06T04:30:17.843Z
Answers.Text: There's also the `craft\commerce\services\Email::EVENT_BEFORE_SEND_MAIL` event, which provides an `order` and `email` parameters—you could listen to this and manipulate the `Email` object's recipients. This way, you wouldn't need to re-invent any template rendering (assuming the same email content is still useful).
Answers.UserDisplayName: August Miller
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-09T23:06:21.737Z
Answers.LastActivityDate: 2018-03-09T23:06:21.737Z
Answers.UserDisplayName: Brad Bell
Body: <p>On a website I will be setting up there will be different ranges/types of products.
  Basically purchased from different departments within the organisation.</p>
  
  <p>I can filter the products in different ways - either by a category or product type of whatever. 
  But is there any way to change where the confirmation email goes to.
  E.g. All confirmation emails go to finance@domain.com</p>
  
  <p>But if a item is purchased from Category A/Product Type A the confirmation email also goes to deptA@domain.com</p>
  
  <p>An item purchased from Category B/Product Type B - the confirmation email goes to deptB@domain.com</p>
  
  <p>Is this functionality easily achievable or will some sort of plugin be required?</p>
  
Tags: <plugin-craftcommerce><emails>
Title: Craft Commerce - Different confirmation email address for different product types or category
ThreadText: # Craft Commerce - Different confirmation email address for different product types or category
  
  (Asked by: username_0 on 2018-03-09)
  
  On a website I will be setting up there will be different ranges/types of products.
  Basically purchased from different departments within the organisation.
  
  I can filter the products in different ways - either by a category or product type of whatever.
  But is there any way to change where the confirmation email goes to.
  E.g. All confirmation emails go to finance@domain.com
  
  But if a item is purchased from Category A/Product Type A the confirmation email also goes to deptA@domain.com
  
  An item purchased from Category B/Product Type B - the confirmation email goes to deptB@domain.com
  
  Is this functionality easily achievable or will some sort of plugin be required?
  
  **Tags:** plugin-craftcommerce, emails
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-03-09. Score: 0
  
  Should be pretty doable with a small plugin.
  
  You'd want to listen to something like the [onOrderComplete](https://craftcommerce.com/docs/events-reference#commerce_orders.onordercomplete) event, then loop through the line items making note of which product types the line items belong to, adding email address to an array to send to.
  
  Then at the end, you can loop through your email address sending the appropriate emails out to each of the users.
  
  > **Comments:**
  > **username_2**: There's also the `craft\commerce\services\Email::EVENT_BEFORE_SEND_MAIL` event, which provides an `order` and `email` parameters—you could listen to this and manipulate the `Email` object's recipients. This way, you wouldn't need to re-invent any template rendering (assuming the same email content is still useful).  
  
  ---
  
  