Support » Plugin: Quantity Field on Shop Page for WooCommerce » Notice: id was called incorrectly error

  • Hi,

    Found a line of code that needs updating.
    If you turn WP_DEBUG on you will see below error.

    Notice: id was called incorrectly. Product properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/storefront/page.php'), get_template_part, locate_template, load_template, require('/themes/storefront/content-page.php'), do_action('storefront_page'), WP_Hook->do_action, WP_Hook->apply_filters, storefront_page_content, the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, WC_Shortcodes::products, WC_Shortcode_Products->get_content, WC_Shortcode_Products->product_loop, wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-product.php'), do_action('woocommerce_after_shop_loop_item'), WP_Hook->do_action, WP_Hook->apply_filters, 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_f in /home/lantaugroc/domains/lantau-grocer.com/public_html/wp-includes/functions.php on line 4204

    That should mean a direct call of product information (in this case, product id) is not allowed. I looked it up in google and I think if you change

    Line 61 on wc-quantity-field-shop-page.php of your plugin

    from
    .$product->id

    to
    .$product->get_id()

    would make the error go away.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Notice: id was called incorrectly error’ is closed to new replies.