REST error since version 2.021
-
Since the 2.0.21 release the REST API call, fetching all terms for an attribute fails with the following error. This only happens for the first time I do this call, later call seem to work correctly.
PHP Fatal error: Uncaught Error: Call to undefined method Woo_Variation_Swatches_Backend::get_group() in /wp-content/plugins/woo-variation-swatches/includes/class-woo-variation-swatches-wc-api-response.php:50 Stack trace: #0 /wp-includes/rest-api/endpoints/class-wp-rest-controller.php(439): Woo_Variation_Swatches_WC_API_Response->get_additional_response() #1 /wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php(150): WP_REST_Cont roller->add_additional_fields_to_object() #2 /wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php(349): WC_REST_Product_Attribute_Terms_V 1_Controller->prepare_item_for_response() #3 /wp-includes/rest-api/class-wp-rest-server.php(118 in /wp-content/plugins/woo-variation-swatche s/includes/class-woo-variation-swatches-wc-api-response.php on line 50
The addition rest api response calls a method that hasn’t been defined.
When I disable this block the code works as expected.Workaround for now is to remove the extra rest-api (get_callback) call in
/wp-content/plugins/woo-variation-swatches/includes/class-woo-variation-swatches-wc-api-response.php:30
public function register_woo_variation_swatches_field() { register_rest_field('product_attribute_term', 'woo_variation_swatches', array( // 'get_callback' => array( $this, 'get_additional_response' ), // << FIX 'update_callback' => array( $this, 'update_additional_response' ), 'schema' => array( $this, 'additional_response_schema' ), )); }
It looks like the class hasn’t been loaded yet in this situation?
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘REST error since version 2.021’ is closed to new replies.