Closed SUGO-es closed 3 years ago
I've fixed this by adding ,'context' => 'view'
to line 143 of includes/apiv2/class-wc-pos-products.php
in the plugin.
It would probably also work on line 135 if you're using a Woocommerce version below 3.7.
Yes, I already fixed it with the same solution, thanks for the contribution.
Hi,
I have the log of several stores full of "Undefined index: context" notifications.
After looking for the debug queue I see that it is POS that is causing this ...
"Undefined index: context" en archivo "/wp-content/plugins/woocommerce/packages/woocommerce-rest-api/src/Controllers/Version3/class-wc-rest-controller.php" en la linea: "459".Petición: Array ( [security] => 9c [filter] => Array ( [limit] => -1 [in] => 5290,5468 )
)
1) /index.php(17): require('/var/www/vhosts...') 2) /wp-blog-header.php(16): wp() 3) /wp-includes/functions.php(1255): WP->main('') 4) /wp-includes/class-wp.php(729): WP->parse_request('') 5) /wp-includes/class-wp.php(387): do_action_ref_array('parse_request', Array) 6) /wp-includes/plugin.php(544): WP_Hook->do_action(Array) 7) /wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array) 8) /wp-includes/class-wp-hook.php(288): rest_api_loaded(Object(WP)) 9) /wp-includes/rest-api.php(305): WP_REST_Server->serve_request('/wc/v3/products') 10 /wp-includes/rest-api/class-wp-rest-server.php(329): WP_REST_Server->dispatch(Object(WP_REST_Request)) 11) /wp-includes/rest-api/class-wp-rest-server.php(946): WC_REST_CRUD_Controller->get_items(Object(WP_REST_Request)) 12) /wp-content/plugins/woocommerce/packages/woocommerce-rest-api/src/Controllers/Version3/class-wc-rest-crud-controller.php(362): WC_REST_Products_V2_Controller->prepare_object_for_response(Object(WC_Product_Variable), Object(WP_REST_Request)) 13) /wp-content/plugins/woocommerce/packages/woocommerce-rest-api/src/Controllers/Version2/class-wc-rest-products-v2-controller.php(189): apply_filters('woocommerce_res...', Object(WP_REST_Response), Object(WC_Product_Variable), Object(WP_REST_Request)) 14) /wp-includes/plugin.php(206): WP_Hook->apply_filters(Object(WP_REST_Response), Array) 15) /wp-includes/class-wp-hook.php(288): WC_POS_APIv2_Products->product_response(Object(WP_REST_Response), Object(WC_Product_Variable), Object(WP_REST_Request)) 16) /wp-content/plugins/woocommerce-pos/includes/apiv2/class-wc-pos-products.php(143): WC_REST_CRUD_Controller->get_item(Array) 17) /wp-content/plugins/woocommerce/packages/woocommerce-rest-api/src/Controllers/Version3/class-wc-rest-crud-controller.php(143): WC_REST_Product_Variations_Controller->prepare_object_for_response(Object(WC_Product_Variation), Array) 18) /wp-content/plugins/woocommerce/packages/woocommerce-rest-api/src/Controllers/Version3/class-wc-rest-product-variations-controller.php(83): WP_REST_Controller->add_additional_fields_to_object(Array, Array) 19) /wp-includes/rest-api/endpoints/class-wp-rest-controller.php(391): WC_REST_Controller->get_fields_for_response(Array)
Could you try to improve this?
Thank you very much for advancement and for this great plugin!