dprntkxh703029 2019-03-01 15:48
浏览 67
已采纳

在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>'
);
  • 写回答

1条回答 默认 最新

  • dongqian6554 2019-03-01 16:25
    关注

    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>' );
    }
    

    It should works (where you will replace custom-one and custom-two by your custom statuses slugs)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?