Skip to content

Instantly share code, notes, and snippets.

@chetansatasiya
Created February 9, 2018 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chetansatasiya/feda6f5f566244723ef0692eeeaf7e34 to your computer and use it in GitHub Desktop.
Save chetansatasiya/feda6f5f566244723ef0692eeeaf7e34 to your computer and use it in GitHub Desktop.
Woocommerce add coupon code in new order admin email
<?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