在Woocommerce电子邮件通知中显示自定义订单状态的付款链接 [英] Display a payment link for custom order statuses in Woocommerce email notifications
本文介绍了在Woocommerce电子邮件通知中显示自定义订单状态的付款链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在努力使它起作用.我需要在woocommerce电子邮件中显示此付款链接,但仅显示某些(自定义)订单状态.怎么做?谢谢:)
I've been struggling for a while to get this to work. I need to show this payment link in my woocommerce emails, but only on certain (custom) order statuses. How is it done? Thanks :)
printf(
wp_kses(
/* translators: %1s item is the name of the site, %2s is a html link */
__( '%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__( 'Click here to pay for this order', 'woocommerce' ) . '</a>'
);
推荐答案
您将在以下方式中使用 WC_Order
方法 get_status()
:
You will use the WC_Order
method get_status()
in something like:
if( in_array( $order->get_status(), array( 'custom-one', 'custom-two') ) ) {
printf( wp_kses(
/* translators: %1s item is the name of the site, %2s is a html link */
__( '%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__( 'Click here to pay for this order', 'woocommerce' ) . '</a>' );
}
它应该起作用(在其中,您可以用自定义状态标签替换 custom-one
和 custom-two
)
It should works (where you will replace custom-one
and custom-two
by your custom statuses slugs)
这篇关于在Woocommerce电子邮件通知中显示自定义订单状态的付款链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文