2
votes

I was wondering if there is a way to separate my processing orders email via the purchased products category.

I know that's not very clear :P

For example:

  • I have two products. Test1 and Test2. Test1 has the category 'ICT Sale', while Test2 has 'Private Sale'.
  • If someone purchases Test1 I would like the email to say 'Thank you for buying an ICT product'
  • If someone purchases Test2 I want it to say 'This is a private sale!'

Unfortunately I'm more fluent with JS than PHP and WP hooks (and I'm assuming a if / else statement won't work here :P)

Thanks for any help in advance!

2

2 Answers

2
votes

You can copy the email template in your theme and then do what ever you want.

For exemple, copy woocommerce/templates/emails/customer-processing-order.php to themes/yourtheme/woocommerce/emails/customer-processing-order.php

then edit customer-processing-order.php something like this should to your trick (you need to complete then to display whatever you want)

$ict = false;
$private = false;

foreach ( $order->get_items() as $item ){
    $categories = get_the_terms( $item['product_id'] , 'product_cat' );

    foreach( $categories as $categorie ) {
        if ($categorie->slug == 'ICT') {
            $ict = true;
        }elseif( $categorie->slug == 'private-sale-slug' ) {
            $private = true;
        }
    }
}
-1
votes
Hi bro Please go to wocommerce product page (wp-admin/edit.php?post_type=product) and
click on the quickedit of test2 product. Here see you selected checkbox on private so
comout message ('This is a private sale!') when purchage product test2 .please remove
selected checkbox on private.