Als je wilt dat de e-mails voor de status 'in behandeling' of 'order afgerond' niet verstuurd worden kun je deze code toevoegen in de functions.php van je thema of in de Code Snippets plugin.


// disable email specific products based on category

add_filter( 'woocommerce_email_enabled_customer_processing_order', 'disable_emails_for_products', 10, 2 );
add_filter( 'woocommerce_email_enabled_customer_completed_order',  'disable_emails_for_products', 10, 2 );

function disable_emails_for_products( $enabled, $order ) {

  if ( isset( $order ) && count( $order->get_items() ) > 0 ) {

    foreach( $order->get_items() as $item ) {

      if ( 'line_item' == $item['type'] ) {

        $product = $order->get_product_from_item( $item );
        foreach ( array( 'categorie1', 'categorie2', 'categorie3' ) as $category ) {
          if ( has_term( $category, 'product_cat', $product->get_post_data() ) ) {
            return false;
          }
        }
      }
    }
  }

  return $enabled;
}