• Resolved jimbo777

    (@jimbo777)


    Hi,

    Since recently I am getting a new PHP notice or warning in debug.log. It shows:

    [08-Dec-2020 12:09:15 UTC] id was called incorrectly. Order properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), do_action(‘template_redirect’), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::do_wc_ajax, do_action(‘wc_ajax_checkout’), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::checkout, WC_Checkout->process_checkout, WC_Checkout->process_order_payment, apply_filters(‘woocommerce_payment_successful_result’), WP_Hook->apply_filters, WC_GZD_Emails->send_order_confirmation_mails, do_action(‘woocommerce_gzd_order_confirmation’), WP_Hook->do_action, WP_Hook->apply_filters, WC_Emails::send_transactional_email, do_action_ref_array(‘woocommerce_gzd_order_confirmation_notification’), WP_Hook->do_action, WP_Hook->apply_filters, WC_GZD_Emails->trigger_order_confirmation_emails, WC_Email_New_Order->trigger, WC_Email->get_attachments, apply_filters(‘woocommerce_email_attachments’), WP_Hook->apply_filters, WPO\WC\PDF_Invoices\Main->attach_pdf_to_email, WPO\WC\PDF_Invoices\Main->get_documents_for_email, apply_filters(‘wpo_wcpdf_custom_attachment_condition’), WP_Hook->apply_filters, wpo_wcpdf_exclude_payment_method, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0.

    I am assuming that this is related to this plugin. Does anyone know how I can get rid of this?

    Thanks,
    Chris

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi Chris,
    This appears to be referring to a custom code snippet with the function wpo_wcpdf_exclude_payment_method, probably taken from this thread.
    If that’s indeed the case, you can update the code by replacing this:

    
    $payment_method = get_post_meta( $order->id, '_payment_method', true );
    

    with:

    
    $payment_method = $order->get_payment_method();
    

    Let us know if that indeed resolves the issue!

    Thread Starter jimbo777

    (@jimbo777)

    Oh wow! You are 100% correct! My bad. Thanks for the patch. I really appreciate it. You rock!!

    Plugin Contributor Ewout

    (@pomegranate)

    No worries, that code was outdated but there is no way for us to mark old posts as such. Glad it’s resolved!

    If you can spare a minute to leave a review here on www.remarpro.com we always appreciate that. Thanks in advance!

    Thread Starter jimbo777

    (@jimbo777)

    Sure. Done! Thx again

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Order properties should not be accessed directly’ is closed to new replies.