• Resolved OC WordPress Web Designer

    (@oc-wordpress-web-designer)


    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
    }

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the following places for more development-oriented questions:

    1. WooCommerce Slack Community: https://woocommerce.com/community-slack/
    2. Advanced WooCommerce group on Facebook: https://www.facebook.com/groups/advanced.woocommerce/
    Thread Starter OC WordPress Web Designer

    (@oc-wordpress-web-designer)

    Putting the coupon code description in an email seems like it should be a basic function in Woocommerce, not a complex development issue.

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    This forum is volunteer-based, so it depends on who happens to be able to look at your question.

    If you need further support with this, I highly recommend contacting one of the services on our customizations page: https://woocommerce.com/customizations/

    I’ll mark this thread as closed now, as no-one has been able to answer you. If you have any further questions, please feel free to create a new thread.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add Coupon Code Amount/Description To Email Notification’ is closed to new replies.