我最近注意到客户发票电子邮件中缺少付款链接。我尝试了各种主题,并禁用了所有其他插件,但是没有运气。
即使付款失败,这也是全部处理过程:http://prntscr.com/s9x8o5
我看到客户发票模板http://prntscr.com/s9x902中似乎是正确的代码,但是由于某些原因它无法正常工作。即使订单状态失败,此行也不会显示。
关于如何重新获得付款链接的任何想法?我在某处缺少设置吗?
答案 0 :(得分:0)
如果该订单对象正确,请尝试在电子邮件顶部打印订单对象。
/**
* Executes the e-mail header.
*
* @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
echo '<pre>$order:-';
print_r( $order );
echo '</pre>';
?>
<?php if ( $order->has_status( 'pending' ) ) { ?>
<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>
<?php
}