Linked variation enabled, getting products by API throws error
-
Hi,
We don`t know why but when linked variation is enabled getting products by API throws an error. Setting max 100 products to get at one query, ends with error below. But decreasing max products per query to 27 it returns without an error. Looks like 27 i magic number of products to return. E.g. setting max products to 10, i return first and second page but third throws an error. Any idea how to fix this?
Widget is added via shortcode [wpclv] in excerpt.
Thanks in advance
Roebrt<br />
<b>Fatal error</b>: Uncaught Error: Call to a member function get_id() on null in /alt/home/webmaster.alkan/www/alkan.pl/wp-content/plugins/wpc-linked-variation/wpc-linked-variation.php:92
Stack trace:
#0 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/shortcodes.php(356): WPCleverWpclv->shortcode(Array, ”, ‘wpclv’)
#1 [internal function]: do_shortcode_tag(Array)
#2 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/shortcodes.php(228): preg_replace_callback(‘/\\[(\\[?)(wpclv)…’, ‘do_shortcode_ta…’, ‘<p>Punktowa opr…’)
#3 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/class-wp-hook.php(303): do_shortcode(‘<p>Punktowa opr…’)
#4 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/plugin.php(189): WP_Hook->apply_filters(‘<p>Punktowa opr…’, Array)
#5 /alt/home/webmaster.alkan/www/alkan.pl/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php(689): apply_filters(‘woocommerce_sho…’, ‘Punktowa oprawa…’)
#6 /alt/home/webmaster.alkan/www/alkan.pl/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php(163): WC_REST_Products_V2_Controller->get_product_data(Object(WC_Product_Simple), ‘view’, Object(WP_REST_Request))
#7 /alt/home/webmaster.alkan/www/alkan.pl/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php(391): WC_REST_Products_V2_Controller->prepare_object_for_response(Object(WC_Product_Simple), Object(WP_REST_Request))
#8 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/rest-api/class-wp-rest-server.php(1140): WC_REST_CRUD_Controller->get_items(Object(WP_REST_Request))
#9 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/rest-api/class-wp-rest-server.php(987): WP_REST_Server->respond_to_request(Object(WP_REST_Request), ‘/wc/v2/products’, Array, NULL)
#10 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/rest-api/class-wp-rest-server.php(414): WP_REST_Server->dispatch(Object(WP_REST_Request))
#11 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/rest-api.php(370): WP_REST_Server->serve_request(‘/wc/v2/products’)
#12 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/class-wp-hook.php(303): rest_api_loaded(Object(WP))
#13 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
#14 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/plugin.php(518): WP_Hook->do_action(Array)
#15 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/class-wp.php(388): do_action_ref_array(‘parse_request’, Array)
#16 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/class-wp.php(750): WP->parse_request(”)
#17 /alt/home/webmaster.alkan/www/alkan.pl/wp-includes/functions.php(1291): WP->main(”)
#18 /alt/home/webmaster.alkan/www/alkan.pl/wp-blog-header.php(16): wp()
#19 /alt/home/webmaster.alkan/www/alkan.pl/index.php(17): require(‘/alt/home/webma…’)
#20 {main}
thrown in <b>/alt/home/webmaster.alkan/www/alkan.pl/wp-content/plugins/wpc-linked-variation/wpc-linked-variation.php</b> on line <b>92</b><br />
- The topic ‘Linked variation enabled, getting products by API throws error’ is closed to new replies.