Add Coupon Code Amount/Description To Email Notification
-
I added the coupon code that was used to an order email by adding the code below. However, I want it to also add the discount amount and/or the coupon description in addition to just the coupon code that was used. How do I do that?
add_action( ‘woocommerce_email_after_order_table’, ‘add_payment_method_to_admin_new_order’, 15, 2 );
/**
* Add used coupons to the order confirmation email
*
*/
function add_payment_method_to_admin_new_order( $order, $is_admin_email ) {if ( $is_admin_email ) {
if( $order->get_used_coupons() ) {
$coupons_count = count( $order->get_used_coupons() );
$i = 1;
$coupons_list = ”;foreach( $order->get_used_coupons() as $coupon) {
$coupons_list .= $coupon;
if( $i < $coupons_count )
$coupons_list .= ‘, ‘;
$i++;
}echo ‘<p>Coupons used (‘ . $coupons_count . ‘) : ‘ . $coupons_list . ‘</p>’;
} // endif get_used_coupons
} // endif $is_admin_email
}- This topic was modified 5 years, 11 months ago by .
- This topic was modified 5 years, 11 months ago by .
The page I need help with: [log in to see the link]
- The topic ‘Add Coupon Code Amount/Description To Email Notification’ is closed to new replies.