Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Would need to customise the email templates being used. Template overrides can be done in a child theme – have a look at the following guide to point you in the right direction: https://docs.woocommerce.com/document/template-structure/

    @ballmouse – In addition to what Riaan mentioned, please take a look at this article. It nicely explains the code you need to use/place in your theme’s functions.php file. I hope this keeps you moving. If you stuck, please give us a shout 🙂

    Thread Starter ballmouse

    (@ballmouse)

    Thanks.

    I was able to made some change to that linked code and came up with:

    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( $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></p>';
    		    echo '<p><strong>Credit(s) used (' . $coupons_count . ') :</strong> ' . $coupons_list . '</p>';
    
    		} // endif get_used_coupons
    }

    Thank you! This was very helpful. To clarify, it’s the functions.php file in a person’s theme that needs editing. Using WooCommerce’s “override” instructions did not work for me. Since I did not want to create a Child theme, and I did not want to lose these revisions upon the next theme update, I chose to use Arthur Gareginyan’s “My Custom Functions” plugin. Worked like a charm.

    • This reply was modified 7 years, 6 months ago by Jason.
    mlaw84

    (@mlaw84)

    Thanks, this worked well. I put it in the functions.php file.

    The only change I made was calling it Coupon(s) instead of Credit(s).

    Otherwise, it shows in both admin order email and new customer order email.

    Using Woocommerce 2.6

    • This reply was modified 7 years ago by mlaw84.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding Used Coupon Code into Customer Emails’ is closed to new replies.