Voeg deze code toe aan functions.php van je thema of Code Snippets plugin.


// The email function hooked that display the text
add_action( 'woocommerce_email_order_details', 'display_applied_coupons', 10, 4 );
function display_applied_coupons( $order, $sent_to_admin, $plain_text, $email ) {

// Only for admins and when there at least 1 coupon in the order
if ( ! $sent_to_admin && count($order->get_items('coupon') ) == 0 ) return;

foreach( $order->get_items('coupon') as $coupon ){
$coupon_codes[] = $coupon->get_code();
}
// For one coupon
if( count($coupon_codes) == 1 ){
$coupon_code = reset($coupon_codes);
echo '

'.__( 'Kortingscode gebruikt: ').$coupon_code.'

';
}
// For multiple coupons
else {
$coupon_codes = implode( ', ', $coupon_codes);
echo '

'.__( 'Kortingscodes gebruikt: ').$coupon_codes.'

';
}
}