Site logo

Archived topic

Exception "invalid product" in generatepress_wc_show_sticky_add_to_cart()

7 replies · Started by healthandbeauty on October 21, 2019

Viewing posts 1–8 of 8

If the GP Premium sticky add to cart functionality is enabled, we got a log of "Invalid Product" exceptions while browsing static pages. The problem comes from line 1069 in the woocommerce\functions\functions.php. If you move the is_singlar or/and the generatepress_wc_get_setting( 'sticky_add_to_cart_panel' ) in front of the $product = wc_get_product( get_the_ID() ); line. The error is gone.

Best regards
David

Hi there,

Strange, never experienced this before.

What version of PHP and WooCommerce are you using?

Let me know :)

Hi Tom,

we are using

  • Woocommerce 3.7.0
  • PHP 7.3 in a Docker container
  • GP Premium 1.8.3
  • Generate Press 2.3.2

Stack Trace:


[22-Oct-2019 06:26:33 UTC] PHP Exception:  Ungültiges Produkt. in /var/www/html/wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php on line 163
[22-Oct-2019 06:26:33 UTC] PHP Stack trace:
[22-Oct-2019 06:26:33 UTC] PHP   1. {main}() /var/www/html/index.php:0
[22-Oct-2019 06:26:33 UTC] PHP   2. require() /var/www/html/index.php:17
[22-Oct-2019 06:26:33 UTC] PHP   3. require_once() /var/www/html/wp/wp-blog-header.php:19
[22-Oct-2019 06:26:33 UTC] PHP   4. include() /var/www/html/wp/wp-includes/template-loader.php:78
[22-Oct-2019 06:26:33 UTC] PHP   5. get_header($name = *uninitialized*) /var/www/html/wp-content/themes/generatepress/page.php:17
[22-Oct-2019 06:26:33 UTC] PHP   6. locate_template($template_names = array (0 => 'header.php'), $load = TRUE, $require_once = *uninitialized*) /var/www/html/wp/wp-includes/general-template.php:41
[22-Oct-2019 06:26:33 UTC] PHP   7. load_template($_template_file = '/var/www/html/wp-content/themes/generatepress/header.php', $require_once = TRUE) /var/www/html/wp/wp-includes/template.php:671
[22-Oct-2019 06:26:33 UTC] PHP   8. require_once() /var/www/html/wp/wp-includes/template.php:722
[22-Oct-2019 06:26:33 UTC] PHP   9. wp_head() /var/www/html/wp-content/themes/generatepress/header.php:17
[22-Oct-2019 06:26:33 UTC] PHP  10. do_action($tag = 'wp_head', $arg = *uninitialized*) /var/www/html/wp/wp-includes/general-template.php:2745
[22-Oct-2019 06:26:33 UTC] PHP  11. WP_Hook->do_action($args = array (0 => '')) /var/www/html/wp/wp-includes/plugin.php:465
[22-Oct-2019 06:26:33 UTC] PHP  12. WP_Hook->apply_filters($value = '', $args = array (0 => '')) /var/www/html/wp/wp-includes/class-wp-hook.php:310
[22-Oct-2019 06:26:33 UTC] PHP  13. wp_enqueue_scripts('') /var/www/html/wp/wp-includes/class-wp-hook.php:286
[22-Oct-2019 06:26:33 UTC] PHP  14. do_action($tag = 'wp_enqueue_scripts', $arg = *uninitialized*) /var/www/html/wp/wp-includes/script-loader.php:2539
[22-Oct-2019 06:26:33 UTC] PHP  15. WP_Hook->do_action($args = array (0 => '')) /var/www/html/wp/wp-includes/plugin.php:465
[22-Oct-2019 06:26:33 UTC] PHP  16. WP_Hook->apply_filters($value = '', $args = array (0 => '')) /var/www/html/wp/wp-includes/class-wp-hook.php:310
[22-Oct-2019 06:26:33 UTC] PHP  17. generatepress_wc_scripts('') /var/www/html/wp/wp-includes/class-wp-hook.php:286
[22-Oct-2019 06:26:33 UTC] PHP  18. generatepress_wc_show_sticky_add_to_cart() /var/www/html/wp-content/plugins/gp-premium/woocommerce/functions/functions.php:209
[22-Oct-2019 06:26:33 UTC] PHP  19. wc_get_product($the_product = 7, $deprecated = *uninitialized*) /var/www/html/wp-content/plugins/gp-premium/woocommerce/functions/functions.php:1069
[22-Oct-2019 06:26:33 UTC] PHP  20. WC_Product_Factory->get_product($product_id = 7, $deprecated = array ()) /var/www/html/wp-content/plugins/woocommerce/includes/wc-product-functions.php:64
[22-Oct-2019 06:26:33 UTC] PHP  21. WC_Product_Simple->__construct($product = 7, array ()) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-product-factory.php:46
[22-Oct-2019 06:26:33 UTC] PHP  22. WC_Product_Simple->__construct($product = 7) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-product-simple.php:24
[22-Oct-2019 06:26:33 UTC] PHP  23. WC_Data_Store->read(...) /var/www/html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:135
[22-Oct-2019 06:26:33 UTC] PHP  24. WC_Product_Data_Store_CPT->read(...) /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-data-store.php:159

And this is happening when you visit standard pages? What about when you visit products?

Thanks for the info! We'll get it sorted :)

Hi Tom,

sorry was in holidays the last days.

This error happens if I visit "standard" pages, eg. Shipping, Payment information pages. There is no error on products.

Best regards
David

I can't replicate this at all for some reason.

Does it happen if you deactivate all of your other plugins?

Hi Tom,

my bad. The error was shown due to a xdebug setting in my php.ini.

xdebug.show_error_trace = 1
xdebug.show_exception_trace = 1

Best regards
David

Glad you figured it out :)

This archived topic is closed to new replies.