• Resolved supportadtribes

    (@supportadtribes)


    When calling the add_to_cart function like this:

    if((is_numeric($product_id)) AND ($product_id > 0) AND (!empty($product_id))){
    WC()->cart->add_to_cart( $product_id, $quantity );
    }

    These errors show in the WooCommerce fatal error logs:

    2022-04-21T14:29:22+00:00 CRITICAL Uncaught Error: Call to a member function get_attributes() on bool in /var/www/xxx/public_html/wp-content/plugins/woocommerce/includes/class-wc-cart.php:1045
    Stack trace:
    #0 /var/www/xxx/public_html/wp-content/plugins/woo-product-feed-elite/classes/class-get-products.php(828): WC_Cart->add_to_cart(0, 1)

    Do you have any idea why this is and how to prevent this as we made sure the product IS numeric and bigger than 0?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @supportadtribes, thank you for reaching out.

    Please note that this forum is intended to provide support for the default version of the WooCommerce core plugin, and guidance on developing extended functionalities falls outside our scope of support. I can recommend you this links for resources and questions about developing for WooCommerce:

    That said, I have noticed that the error seems to be coming from the plugin Woo Product Feed Pro, so I’d recommend as a first step to disable the plugin and check if the error ceases.

    Regards

    Seems we’ve not had additional inputs on this thread. Thus, we encourage you to make use of the above resources. Hopefully, the information shared was helpful.

    I’ll go ahead and mark the thread as closed but please feel free to create a new thread if you have further questions.

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

The topic ‘CRITICAL Uncaught Error’ is closed to new replies.