2016-08-16 4 views
1

고객이이 주문을 사용하지 않은 경우 전자 메일 주문에 쿠폰 메시지를 표시하는 that code이 있습니다.주문 완료 상태의 전자 메일에 쿠폰 메시지 표시

그 쿠폰 메시지는 에만 표시하고 싶습니다. 대신 모든 메일에 주문을 완료했습니다.

add_action('woocommerce_email_before_order_table', 'processing_order_mail_message', 20); 
function processing_order_mail_message($order) { 
    if (empty($order->get_used_coupons()) && ($order->post_status == 'wc-on-hold' || $order->post_status == 'wc-processing')) 
     echo '<h2 id="h2thanks">Get 20% off</h2><p id="pthanks">Thank you for making this purchase! Come back and use the code "<strong>Back4More</strong>" to receive a 20% discount on your next purchase! Click here to continue shopping.</p>'; 
} 

어떻게 구현할 수 있습니까? 그것은 단지 "완전한"주문 상태를 들면, if 문 2 조건과 이메일에 사용자 정의 메시지를 표시 할 쉽게

답변

2

감사합니다.

add_action('woocommerce_email_before_order_table', 'completed_order_mail_message', 20); 
function completed_order_mail_message($order) { 
    if (empty($order->get_used_coupons()) && $order->post_status == 'wc-completed') 
     echo '<h2 id="h2thanks">Get 20% off</h2><p id="pthanks">Thank you for making this purchase! Come back and use the code "<strong>Back4More</strong>" to receive a 20% discount on your next purchase! Click here to continue shopping.</p>'; 
} 

이 코드는이 코드는 테스트

function.php의 활성 자식 테마의 파일이나 테마에 가서 작동 완벽한

하지만 ~ 자동 완성
WooCommerce: Auto complete paid Orders (depending on Payment methods)

참조 :

전자 지불 주문은 당신이 뭔가를 추가 할 필요가