Skip to content

Instantly share code, notes, and snippets.

@iamsathyaseelan
Last active June 8, 2020 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamsathyaseelan/2ed79fad0a8184e7d5dbeb7883636973 to your computer and use it in GitHub Desktop.
Save iamsathyaseelan/2ed79fad0a8184e7d5dbeb7883636973 to your computer and use it in GitHub Desktop.
remove next ordercoupon in order notification email
add_filter('rnoc_before_displaying_next_order_coupon', "rnoc_before_displaying_next_order_coupon", 10, 2);
/**
* @param $message
* @param $order \WC_Order
* @return string
*/
function rnoc_before_displaying_next_order_coupon($message, $order)
{
if (method_exists($order, 'get_billing_email')) {
$order_email = $order->get_billing_email();
$args = array(
'meta_key' => 'email',
'meta_value' => $order_email,
'post_type' => 'rnoc_order_coupon',
'posts_per_page' => -1
);
$posts = get_posts($args);
if (count($posts) == 1) {
return $message;
} else {
$message = "";
}
}
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment