• Resolved Cezar Ayran

    (@ayrancd)


    I found this function $order->get_used_coupons() but I don’t want only used coupons…

    I have gift cards that use the coupon feature so in my order I can have many coupons that we call gift cards… I’d like to add them to my email order notification… I already copied the template file to my child theme, how do I add that info in my email? Tks!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Cezar Ayran

    (@ayrancd)

    FYI

    We have a plugin that managers all gift cards/coupons called Ultimate Gift Cards For WooCommerce-Parent

    Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    You’d need to get in touch with the developers of that plugin to check what code they’re using for their gift cards – this isn’t something that the core WooCommerce plugin would have any direct control over.

    Thread Starter Cezar Ayran

    (@ayrancd)

    Yes, you’re right.

    So if someone needs it, I got the solution [to be added to wp-content/themes/Avada-child/woocommerce/emails/admin-new-order.php:

    //show coupon to email order
    $orderID = $order->get_id();
    echo "<b>Coupon(s)</b><br>";
    foreach ( $order->get_items() as $item_id => $item ) {
    	$giftcard = get_post_meta($orderID, "$orderID#$item_id", true);
    	$total  = count($giftcard);
    	$coupons = "";
    	for($i = 0; $i < $total; $i++){
    		$coupons .= $giftcard[$i].", ";
    	}
    }
    echo substr($coupons, 0, -2)."<br><br>";
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add coupons to email order’ is closed to new replies.