Home / eCommerce / How to Display Store Credits Earned in WooCommerce New Order Emails
Duplicate Snippet

Embed Snippet on Your Site

How to Display Store Credits Earned in WooCommerce New Order Emails

Add this to your "New Orders" email template from WooCommerce > Settings > Emails

Code Preview
php
<?php
// Add store credit info to WooCommerce new order email notification
// Store credits as coupon (before tax).
$coupons = $order->get_coupons();
foreach ( $coupons as $coupon ) {
    if ( strtolower( $coupon->get_code() ) === 'store credit' ) {
        $sc_amount = $coupon->get_discount();
    }
}
// Store credits after tax
 $sc_data = $order->get_meta( 'acfw_store_credits_order_paid', true );
 $sc_amount = $sc_data['amount'];

Comments

Add a Comment