Php 根据订单状态自定义电子商务电子邮件通知内容
我正在尝试根据自定义的“已发货”订单状态自定义电子邮件通知 这是正常的模板显示: 这是我的密码:Php 根据订单状态自定义电子商务电子邮件通知内容,php,wordpress,templates,woocommerce,email-notifications,Php,Wordpress,Templates,Woocommerce,Email Notifications,我正在尝试根据自定义的“已发货”订单状态自定义电子邮件通知 这是正常的模板显示: 这是我的密码: <?php if( ! $order->has_status('shipped') ) { ?> <p><?php printf( esc_html__( 'Your %s order has been delivered to your provided shipping address and we marked its status to <b&g
<?php if( ! $order->has_status('shipped') ) { ?>
<p><?php printf( esc_html__( 'Your %s order has been delivered to your provided shipping address and we marked its status to <b>completed</b>. Let us know if you have any questions.', 'woocommerce' ), esc_html( wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) ) ); ?></p>
<?php } ?>
您需要将实际的模板结构替换为以下内容(您有一个重复的行):
if(!defined('ABSPATH')){
出口
}
/*
*@hooked WC_Emails::email_header()输出电子邮件头
*/
do_action('woocommerce_email_header',$email_heading,$email);?>
这很好,我用了两种说法<代码>
和
我不知道这样做是否正确,但确实有效P
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/*
* @hooked WC_Emails::email_header() Output the email header
*/
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php /* translators: %s: Customer first name */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
<?php /* translators: %s: Site title */ ?>
<?php if( ! $order->has_status('shipped') ) { ?>
<p><?php printf( esc_html__( 'Your %s order has been delivered to your provided shipping address and we marked its status to <b>completed</b>. Let us know if you have any questions.', 'woocommerce' ), esc_html( wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) ) ); ?></p>
<?php } ?>
<p><?php printf( esc_html__( 'Your %s order has been marked complete on our side.', 'woocommerce' ), esc_html( wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) ) ); ?></p>
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/*
* @hooked WC_Emails::email_header() Output the email header
*/
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php /* translators: %s: Customer first name */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
<?php /* translators: %s: Site title */ ?>
<?php if( ! $order->has_status('shipped') ) { ?>
<p><?php printf( esc_html__( 'Your %s order has been delivered to your provided shipping address and we marked its status to <b>completed</b>. Let us know if you have any questions.', 'woocommerce' ), esc_html( wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) ) ); ?></p>
<?php } ?>
<?php