0

Im using a plugin IWD for woocommerce, and this is a consistent error I'm receiving. Seeking help with how to fix this? Im very new to code, and have attempted to understand it. But it is beyond my level of knowledge.

[Wed Jul 29 19:36:02.765466 2020] [php7:notice] [pid 31401] [client 101.161.102.84:53742] id was called incorrectly. Product 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_iwd_opc_update_order_review'), WP_Hook->do_action, WP_Hook->apply_filters, IWD_OPC_AJAX::iwd_opc_update_order_review, woocommerce_order_review, wc_get_template, include('/plugins/iwd-woocommerce-checkout-suite/public/templates/woocommerce/checkout/review-order.php'), WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong. This message was added in version 3.0., referer: https://

1 Answers1

1

In WC 3.0 there was update adding getters/setters methods ( hello OOP ) for most public variables, but leave them public due to backward compability. In future it become private/protected I guess without additional permissions check and it'll become fatal error, not a warn. So if before we have

$product = wc_get_product($id); // Instance of WC_Product
echo $product->id; // wrong
echo $product->get_id(); // nice

Due to your logs, you are using wd-woocommerce-checkout-suite plugin, last update was more than year ago, so your options

  1. Update iwd-woocommerce-checkout-suite/public/templates/woocommerce/checkout/review-order.php , line 30, from $_product->id to $_product->get_id()
  2. Choose another plugin
Az Rieil
  • 176
  • 10
  • If I edit to this code, it throws a fatal error - could you help? `get_id() ) ): ?>
    get_image(), $cart_item, $cart_item_key ); echo $thumbnail; ?>
    `
    – Brendan Fredrich Jul 29 '20 at 11:30
  • Checked docs - it should be WC_Product. But if it throws error - try to replace `$_product->get_id()` with `apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key )` @BrendanFredrich – Az Rieil Jul 29 '20 at 12:23