• Resolved tbo460

    (@thibotus01)


    Hi,

    This plugin return this error message:

    Got error 'PHP message: post was called incorrectly. Product properties should not be accessed directly. Backtrace: do_action('wp_ajax_nopriv_wc-livechat-check-cart'), WP_Hook->do_action, WP_Hook->apply_filters, WooCommerce_LiveChat->check_cart, WooCommerce_LiveChat->get_custom_livechat_data, WooCommerce_LiveChat->get_products_data, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong. This message was added in version 3.0.\n'

    I think you should fix this and update the plugin that has not received any update for a year… Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • We had the same issue with this showing in the error logs and thought nothing of it. Then WP Engine contacted us and said it’s a problem.

    post was called incorrectly. Product properties should not be accessed directly. Backtrace: do_action('wp_ajax_wc-livechat-check-cart'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, WooCommerce_LiveChat->check_cart, WooCommerce_LiveChat->get_custom_livechat_data, WooCommerce_LiveChat->get_products_data, WC_Product_Subscription_Variation->__get, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong. This message was added in version 3.0.

    You guys can fix it by changing class-woocommerce-livechat.php in the get_products_data() method by getting a WC_Product object from the cart data using wc_get_product() first instead of trying to access it directly.

    Change:

    $url = htmlspecialchars_decode( $product['data']->get_permalink() );
    $title = $product['data']->get_title();

    To:

    $wc_product = wc_get_product( $product['data'] );
    $url = htmlspecialchars_decode( $wc_product->get_permalink() );
    $title = $wc_product->get_title();
    Plugin Author LiveChat

    (@livechat)

    Hi Davebonds,

    Thank you for your advice. We have implemented that in version 1.1.10.

    If you have any other questions, please let me know.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP error message’ is closed to new replies.