Created
February 9, 2018 12:34
-
-
Save chetansatasiya/feda6f5f566244723ef0692eeeaf7e34 to your computer and use it in GitHub Desktop.
Woocommerce add coupon code in new order admin email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('woocommerce_get_order_item_totals','cs_add_discount',10,3); | |
function cs_add_discount($total_rows, $order, $tax_display) { | |
if ( $order->get_total_discount() > 0 ) { | |
$coupons = $order->get_used_coupons(); | |
$total_rows['couponused'] = array( | |
'label' => __( 'Coupon code:', 'woocommerce' ), | |
'value' => '' . implode(",",$coupons), ); | |
} | |
return $total_rows; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment