Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing a fatal error when loading a variable product in the REST API, but not with a simple product. The error message indicates an issue with calling a member function on an array within the WooCommerce Multilingual plugin.
Solution:
We recommend deactivating all third-party plugins except for WooCommerce and WPML-related ones, and switching to a default theme like Twenty Twenty-Two to isolate the issue. This approach helped confirm that the problem might be caused by either a conflicting plugin or the theme currently active on your site. If this resolves the issue, you can reactivate each plugin one by one to identify the specific cause of the conflict.

Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket for further assistance at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by Christopher Amirian 1 month ago.

Assisted by: Christopher Amirian.

Author Posts
August 31, 2024 at 2:00 pm

sayed-mohamed-ameenH

Background of the issue:
I get an error when I load a variable product in the REST API, but I do not get an error with a simple product. The error is: Fatal error: Uncaught Error: Call to a member function get_params() on array in /home/saharabh/public_html/wp-content/plugins/woocommerce-multilingual/classes/Rest/Wrapper/Products/Products.php:65 Stack trace: #0 /home/saharabh/public_html/wp-includes/class-wp-hook.php(324): WCMLRestWrapperProductsProducts->prepare(Object(WP_REST_Response), Object(WC_Product_Variation), Array) #1 /home/saharabh/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Object(WP_REST_Response), Array) #2 /home/saharabh/public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php(168): apply_filters('woocommerce_res...', Object(WP_REST_Response), Object(WC_Product_Variation), Array) #3 /home/saharabh/public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php(143): WC_REST_Product_Variations_Controller->prepare_object_for_response(Object(WC_Product_Variation), Array) #4 /home/saharabh/public_html/wp-content/plugins/wepos/includes/REST/Manager.php(74): WC_REST_CRUD_Controller->get_item(Array) #5 /home/saharabh/public_html/wp-includes/class-wp-hook.php(324): WeDevsWePOSRESTManager->product_response(Object(WP_REST_Response), Object(WC_Product_Variable), Object(WP_REST_Request)) #6 /home/saharabh/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Object(WP_REST_Response), Array) #7 /home/saharabh/public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php(192): apply_filters('woocommerce_res...', Object(WP_REST_Response), Object(WC_Product_Variable), Object(WP_REST_Request)) #8 /home/saharabh/public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php(143): WC_REST_Products_V2_Controller->prepare_object_for_response(Object(WC_Product_Variable), Object(WP_REST_Request)) #9 /home/saharabh/public_html/wp-includes/rest-api/class-wp-rest-server.php(1230): WC_REST_CRUD_Controller->get_item(Object(WP_REST_Request)) #10 /home/saharabh/public_html/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wc/v2/products...', Array, NULL) #11 /home/saharabh/public_html/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request)) #12 /home/saharabh/public_html/wp-includes/rest-api.php(420): WP_REST_Server->serve_request('/wc/v2/products...') #13 /home/saharabh/public_html/wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP)) #14 /home/saharabh/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #15 /home/saharabh/public_html/wp-includes/plugin.php(565): WP_Hook->do_action(Array) #16 /home/saharabh/public_html/wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array) #17 /home/saharabh/public_html/wp-includes/class-wp.php(813): WP->parse_request('') #18 /home/saharabh/public_html/wp-includes/functions.php(1336): WP->main('') #19 /home/saharabh/public_html/wp-blog-header.php(16): wp() #20 /home/saharabh/public_html/index.php(17): require('/home/saharabh/...') #21 {main} thrown in /home/saharabh/public_html/wp-content/plugins/woocommerce-multilingual/classes/Rest/Wrapper/Products/Products.php on line 65

Symptoms:
Fatal error: Uncaught Error: Call to a member function get_params() on array in /home/saharabh/public_html/wp-content/plugins/woocommerce-multilingual/classes/Rest/Wrapper/Products/Products.php:65

Questions:
How can I resolve the error when loading a variable product in the REST API?

August 31, 2024 at 2:30 pm
August 31, 2024 at 3:51 pm #16127924

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

The migration process has started. I will update you when we report the issue to the second tier support.

Thanks.

September 1, 2024 at 1:18 pm #16129035

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

The website copy process is finished, Upon the initial troubleshooting I deactivated all third-party plugins except Woocommerce and WPML-related ones, also enabled the default 2022 theme, and there is no issue retrieving the variable product:

hidden link

Please use the same login information of your website and login here to see:

hidden link

This shows that either a plugin or the theme of your website causes the issue.

Thanks.

September 2, 2024 at 11:36 am #16131319

sayed-mohamed-ameenH

thank you very mcuh my issue resolved

i was able to get the cause of this issue and i resolved it

sayed-mohamed-ameenH confirmed that the issue was resolved on 2024-09-02 11:36:24.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.