如果客户未在此订单中使用任何优惠券,我将获得在电子邮件订单中显示优惠券消息的代码。
我想仅在已完成的订单上而不是在所有邮件上显示该优惠券消息。
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>';
}
我怎样才能做到这一点?
谢谢