Quantcast
Viewing all articles
Browse latest Browse all 65051

WC Compatibility issue: id is called incorrectly

Replies: 0

I’m getting the following message in error_log repeatedly:


[01-Oct-2020 04:09:00 UTC] 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_dgwt_wcas_result_details'), WP_Hook->do_action, WP_Hook->apply_filters, DgoraWcas\Engines\WordPressNative\DetailsBox->getResultDetails, DgoraWcas\Engines\WordPressNative\DetailsBox->getProductDetails, include('/plugins/ajax-search-for-woocommerce/partials/details-panel/product.php'), WC_Shortcodes::product_add_to_cart, woocommerce_template_loop_add_to_cart, wc_get_template, include('/plugins/woocommerce/templates/loop/add-to-cart.php'), apply_filters('woocommerce_loop_add_to_cart_link'), WP_Hook->apply_filters, _wcmmax_add2cart, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong. This message was added in version 3.0.

To fix this, change product->id on line 173 in woo-min-max-quantity.php to product->get_id().

It’ll also be good to change product->id on line 187 to $product_id, avoiding the need for another function call.


Viewing all articles
Browse latest Browse all 65051

Trending Articles