• Resolved seboaus

    (@seboaus)


    Hi,

    I constantly receive PHP notices in my debug.log file:

    PHP Notice:  Function id was called <strong>incorrectly</strong>. Product properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/woocommerce/templates/single-product.php'), wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-single-product.php'), do_action('woocommerce_single_product_summary'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_single_add_to_cart, do_action('woocommerce_simple_add_to_cart'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_simple_add_to_cart, wc_get_template, include('/plugins/woocommerce/templates/single-product/add-to-cart/simple.php'), woocommerce_quantity_input, apply_filters('woocommerce_quantity_input_max'), WP_Hook->apply_filters, IPQ_Filters->input_max_value, wpbo_get_applied_rule, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see <a href="https://ww.wp.xz.cn/support/article/debugging-in-wordpress/">Debugging in Wor in /home/public_html/shop/wp-includes/functions.php on line 5833

    and

    PHP Notice:  Function product_type was called <strong>incorrectly</strong>. Product properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/woocommerce/templates/single-product.php'), wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-single-product.php'), do_action('woocommerce_single_product_summary'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_single_add_to_cart, do_action('woocommerce_simple_add_to_cart'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_simple_add_to_cart, wc_get_template, include('/plugins/woocommerce/templates/single-product/add-to-cart/simple.php'), woocommerce_quantity_input, apply_filters('woocommerce_quantity_input_max'), WP_Hook->apply_filters, IPQ_Filters->input_max_value, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see <a href="https://ww.wp.xz.cn/support/article/debugging-in-wordpress/">Debugging in WordPress</a> fo in /home/public_html/shop/wp-includes/functions.php on line 5833

    I am using a child theme although I am not sure what customisations have been made to the core theme files as others who were employed before me have not documented changes – the plugin has not been updated for over a year to preserve these changes. How can I fix these PHP notices without updating the core theme and losing customisations and functions unknown to me?

    These notices are generated so often that they make the debug.log file take up 100’s of MBs in less than a month which is a lot for just plain text. It generates about 200 lines per hour repeating just the above notices.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @seboaus

    Thanks for reaching out!

    I understand that you are receiving the PHP Notice messages above on your site and you would like to know how to fix it without updating the core theme and losing customizations and functions of the site, correct?

    As a first step, I’d recommend cloning your site to a staging environment and without modifying your live site or impacting customers. Many hosts provide staging facilities, so it’s worth checking in with them. It’s also possible to do it using the free WP Staging plugin.

    Then, on the staging site, please try to switch to the default Storefront theme and only WooCommerce plugin is enabled and see if this works?

    If so, then this kind of problem is usually caused by your theme or a third-party plugin present on your site. We can run a conflict test to verify this.

    If this was caused by a third-party plugin present on your site, it would be best to reach out to the developers for further assistance here.

    If this did not resolve the issue, please share your System Status Report, that will help us further troubleshoot.

    You can find it via WooCommerce > Status. Select Get system report and then Copy for support. Once you’ve done that, you can paste it into your reply here.

    If you could also provide the fatal error logs (if any) under WooCommerce > Status > Logs.

    You could copy and paste your reply here or paste it via https://gist.github.com/ and send the link here.

    Let us know how it goes!

    Thread Starter seboaus

    (@seboaus)

    Hello @xue28

    I created a staging site and did as you suggested. There was one error (one that I did not mention above) that was there regardless of what plugins were enabled. I am not sure what it means:
    PHP Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:100513 Library:30120 in /home/sebocoma/public_html/shop/1679003525321/wp-includes/wp-db.php on line 1753

    The two errors that I mentioned above started to appear when I enabled the WooCommerce Advanced Product Quantities plugin. This plugin has no support and is very old so I cannot contact the developers. By looking at the two errors I sent above, is there anything you suggest that I can change in the code to fix the issue? I have intermediate PHP knowledge. I am not quite sure how to read these errors.

    Thank you for your help.

    Thread Starter seboaus

    (@seboaus)

    I have disabled the plugin now as I do not need it anymore, those two errors are gone. I have also noticed that the error that I sent in my previous reply does not concern the Storefront theme. No further assistance required. Thank you for the help!

    Hi @seboaus

    Okay, glad to know you were able to sorted it out. You can mark this ticket as resolved. If you have any new questions, please create a new ticket.

    Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘PHP Notice: Function id was called incorrectly’ is closed to new replies.