Order ID should not be accessed directly
-
My log files have these notices
[26-Jul-2023 21:53:11 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, WOO_CLV_ADMIN->process_payment, WC_Order->payment_complete, WC_Order->save, WC_Order->status_transition, do_action('woocommerce_order_status_failed_to_processing'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Emails::send_transactional_email, do_action_ref_array('woocommerce_order_status_failed_to_processing_notification'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Email_New_Order->trigger, WC_Email->get_content, WC_Email_New_Order->get_content_html, wc_get_template_html, wc_get_template, include('/plugins/woocommerce/templates/emails/admin-new-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'), WC_Order->get_order_item_totals, apply_filters('woocommerce_get_order_item_totals'), WP_Hook->apply_filters, WOO_CLV_ADMIN->add_card_details_to_account_order, WOO_CLV_ADMIN->get_card_details, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0. [26-Jul-2023 21:53:16 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, WOO_CLV_ADMIN->process_payment, WC_Order->payment_complete, WC_Order->save, WC_Order->status_transition, do_action('woocommerce_order_status_failed_to_processing'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Emails::send_transactional_email, do_action_ref_array('woocommerce_order_status_failed_to_processing_notification'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Email_Customer_Processing_Order->trigger, WC_Email->get_content, WC_Email_Customer_Processing_Order->get_content_html, wc_get_template_html, wc_get_template, include('/plugins/woocommerce/templates/emails/customer-processing-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'), WC_Order->get_order_item_totals, apply_filters('woocommerce_get_order_item_totals'), WP_Hook->apply_filters, WOO_CLV_ADMIN->add_card_details_to_account_order, WOO_CLV_ADMIN->get_card_details, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0.
In trait-woo-clv-apihelper.php, line 340 (v1.0.9), there is code that references
$order->id
Instead, shouldn’t you be using
$order->get_id();
The page I need help with: [log in to see the link]
- The topic ‘Order ID should not be accessed directly’ is closed to new replies.