Support » Plugin: WooCommerce Invoice Gateway - Invoice Payment Gateway Solution » Woo notices: xxx was called incorrectly

  • Cool plugin, but it needs some updates to be fully compatible with recent versions of WooCommerce. If WP is in debug mode, notices similar to the following are displayed when previewing Woo emails:

    Notice: get_payment_method was called incorrectly. Order properties should not be accessed directly. Backtrace: do_action(‘admin_init’), WP_Hook->do_action, WP_Hook->apply_filters, WooCommercePreviewEmails->generate_result, WC_Email_Customer_On_Hold_Order->get_content_html, wc_get_template_html, wc_get_template, include(‘/plugins/woocommerce/templates/emails/customer-on-hold-order.php’), do_action(‘woocommerce_email_order_details’), WP_Hook->do_action, WP_Hook->apply_filters, WC_Emails->order_details, wc_get_template, include(‘/plugins/woocommerce/templates/emails/email-order-details.php’), do_action(‘woocommerce_email_before_order_table’), WP_Hook->do_action, WP_Hook->apply_filters, IGFW\Models\Gateways\IGFW_Invoice_Gateway->email_instructions, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong Please see Debugging in WordPress for more information. (This message was added in version 3.0.) in /path/to/your/wp-includes/functions.php on line 4148

    The notices are displayed because $order->payment_method and $order->id are no longer allowed in WooCommerce. They should be be changed to $order->get_payment_method() and $order->get_id().

    There are 2 files that need updating:

    IGFW\Models\Gateways\IGFW_Invoice_Gateway->email_instructions
    Change $order->payment_method to $order->get_payment_method()

    IGFW\Models\Orders\IGFW_Order_Email
    Change 3 occurrences of $order->id to $order->get_id()

    Please note that the error messages are only warnings, so if you are not in debug mode they are not displayed, and everything still functions normally. I am bringing this to your attention merely as a courtesy.

    • This topic was modified 2 years, 11 months ago by jnicol.
  • The topic ‘Woo notices: xxx was called incorrectly’ is closed to new replies.