WooCommerce:将不同的电子邮件通知消息发送到不同的国家

时间:2019-11-04 23:24:56

标签: php woocommerce

我正在尝试创建一个脚本,在该脚本中,一个国家/地区的客户在收到确认后会收到与其他客户不同的消息。试图弄清楚if else语句是否起作用,这是我目前停留的地方:

<?php if ( $order->has_status( 'pending' ) && ($this->object->shipping_country === 'US')) { ?>
<p>
<?php
printf(
    wp_kses(
        /* translators: %1$s Site title, %2$s Order pay link */
        __( 'An order has been created for you on %1$s. Your invoice is below, with a link to make payment when you’re ready: %2$s', 'woocommerce' ),
        array(
            'a' => array(
                'href' => array(),
            ),
        )
    ),
    esc_html( get_bloginfo( 'name', 'display' ) ),
    '<a href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Pay for this order', 'woocommerce' ) . '</a>'
);
?>
</p>

<?php else if ( $order->has_status( 'pending' ) && ($this->object->shipping_country != 'US')) { ?>
<p>
<?php
printf(
    wp_kses(
        /* translators: %1$s Site title, %2$s Order pay link */
        __( 'An order has been created for you on %1$s. Your invoice is below, with a link to make payment when you’re ready: %2$s', 'woocommerce' ),
        array(
            'a' => array(
                'href' => array(),
            ),
        )
    ),
    esc_html( get_bloginfo( 'name', 'display' ) ),
    '<a href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . esc_html__( 'Pay for this order', 'woocommerce' ) . '</a>'
);
?>
</p>

<?php } else { ?>
<p>
<?php
    /* translators: %s Order date */
    printf( esc_html__( 'Here are the details of your order placed on %s:', 'woocommerce' ), esc_html( wc_format_datetime( $order->get_date_created() ) ) );
?>
</p>

0 个答案:

没有答案