WooCommerce客户电子邮件中的错误-付款方法调用不正确

问题描述 投票:1回答:1

我已经为WooCommerce设置了自定义付款方式,在付款过程中没有任何PHP错误,但是在客户收到的电子邮件中有此错误:

注意:payment_method的调用不正确。订单属性应不能直接访问。回溯:edit_post,wp_update_post,wp_insert_post,do_action('save_post'),WP_Hook-> do_action,WP_Hook-> apply_filters,WC_Admin_Meta_Boxes-> save_meta_boxes,do_action('woocommerce_process_shop_order_meta'),WP_Hook-> do_action,WP_Hook-> apply_filters,WC_Meta_Box_Order_Data :: save,WC_Order-> save,WC_Order-> status_transition,do_action('woocommerce_order_status_on-hold_to_processing'),WP_Hook-> do_action,WP_Hook-> apply_filters,WC_Emails :: send_transactional_email,do_action_ref_array('woocommerce_order_status_on-hold_to_processing_notification'),WP_Hook-> do_action,WP_Hook-> apply_filters,WC_Email_Customer_Processing_Order->触发,WC_Email-> get_content,WC_Email_Customer_Processing_Order-> get_content_html,wc_get_template_html,wc_get_template,包括('/plugins/woocommerce/templates/emails/customer-processing-order.php'),do_action('woocommerce_email_order_details'),WP_Hook-> do_action,WP_Hook->应用中/home/username/public_html/site/wp-includes/functions.php,第5167行

这是电子邮件内容的代码,并且提供完整代码here

public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {

    if ( $this->instructions && ! $sent_to_admin && $this->id === $order->get_payment_method && $order->has_status( 'on-hold' ) ) {
        echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;
    }
}

我将$order->payment_method更改为$order->get_payment_method,但仍然收到错误。

您能指导我进行调试吗?

php wordpress woocommerce orders email-notifications
1个回答
0
投票
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {

    if ( $this->instructions && ! $sent_to_admin && $this->id === $order->get_payment_method() && $order->has_status( 'on-hold' ) ) {
        echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;
    }
}

请尝试这样修改。 get_payment_method()

© www.soinside.com 2019 - 2024. All rights reserved.