• Resolved LA-Studio

    (@choijun)


    [16-Nov-2021 17:43:33 UTC] PHP Fatal error:  Uncaught Error: Call to undefined method WP_Error::get_data() in ../wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/RestApi.php:64
    Stack trace:
    #0 ../wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/BlockTypes/AbstractBlock.php(379): Automattic\WooCommerce\Blocks\RestApi->get_routes_from_namespace('wc/store')
    #1 ../wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/BlockTypes/AbstractBlock.php(317): Automattic\WooCommerce\Blocks\BlockTypes\AbstractBlock->enqueue_data(Array)
    #2 ../wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/BlockTypes/AbstractBlock.php(85): Automattic\WooCommerce\Blocks\BlockTypes\AbstractBlock->enqueue_assets(Array)
    #3 ../wp-includes/class-wp-block.php(221): Automattic\WooCommerce\Blocks\BlockTypes\AbstractBlock->render_callback(Array, '', Object(WP_Block))
    #4 ../wp-includes/blocks.php(868): WP_Block->render()
    #5 ../wp-includes/blocks.php(906): render_block(Array)
    #6 ../wp-includes/class-wp-hook.php(305): do_blocks('<!-- wp:woocomm...')
    #7 ../wp-includes/plugin.php(189): WP_Hook->apply_filters('<!-- wp:woocomm...', Array)
    #8 ../wp-includes/widgets/class-wp-widget-block.php(81): apply_filters('widget_block_co...', '<!-- wp:woocomm...', Array, Object(WP_Widget_Block))
    #9 ../wp-includes/class-wp-widget.php(393): WP_Widget_Block->widget(Array, Array)
    #10 ../wp-includes/widgets.php(831): WP_Widget->display_callback(Array, Array)
    #11 ../wp-content/themes/omens/framework/woocommerce/woocommerce-config.php(723): dynamic_sidebar('sidebar-shop-fi...')
    #12 ../wp-includes/class-wp-hook.php(303): Omens_WooCommerce_Config->add_toolbar_close('')
    #13 ../wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
    #14 ../wp-includes/plugin.php(470): WP_Hook->do_action(Array)
    #15 ../wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php(646): do_action('woocommerce_bef...')
    #16 ../wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php(100): WC_Shortcode_Products->product_loop()
    #17 ../wp-content/plugins/lastudio-element-kit/includes/modules/woocommerce/classes/base-products-renderer.php(43): WC_Shortcode_Products->get_content()
    #18 ../wp-content/plugins/lastudio-element-kit/includes/addons/vendor/woo-products.php(1738): LaStudioKitThemeBuilder\Modules\Woocommerce\Classes\Base_Products_Renderer->get_content()
    #19 ../wp-content/plugins/elementor/includes/base/controls-stack.php(2154): Elementor\LaStudioKit_Woo_Products->render()
    #20 ../wp-content/plugins/elementor/includes/base/widget-base.php(581): Elementor\Controls_Stack->render_by_mode()
    #21 ../wp-content/plugins/elementor/includes/base/widget-base.php(722): Elementor\Widget_Base->render_content()
    #22 ../wp-content/plugins/elementor/includes/base/element-base.php(450): Elementor\Widget_Base->print_content()
    #23 ../wp-content/plugins/elementor/includes/base/element-base.php(744): Elementor\Element_Base->print_element()
    #24 ../wp-content/plugins/elementor/includes/base/element-base.php(450): Elementor\Element_Base->print_content()
    #25 ../wp-content/plugins/elementor/includes/base/element-base.php(744): Elementor\Element_Base->print_element()
    #26 ../wp-content/plugins/elementor/includes/base/element-base.php(450): Elementor\Element_Base->print_content()
    #27 ../wp-content/plugins/elementor/core/base/document.php(1516): Elementor\Element_Base->print_element()
    #28 ../wp-content/plugins/lastudio-element-kit/includes/modules/theme-builder/documents/theme-document.php(401): Elementor\Core\Base\Document->print_elements(Array)
    #29 ../wp-content/plugins/elementor/includes/frontend.php(1055): LaStudioKitThemeBuilder\Modules\ThemeBuilder\Documents\Theme_Document->print_elements_with_wrapper(Array)
    #30 ../wp-content/plugins/elementor/core/base/document.php(1038): Elementor\Frontend->get_builder_content(4696, false)
    #31 ../wp-content/plugins/lastudio-element-kit/includes/modules/theme-builder/documents/theme-document.php(184): Elementor\Core\Base\Document->get_content(false)
    #32 ../wp-content/plugins/lastudio-element-kit/includes/modules/theme-builder/documents/theme-document.php(197): LaStudioKitThemeBuilder\Modules\ThemeBuilder\Documents\Theme_Document->get_content()
    #33 ../wp-content/plugins/lastudio-element-kit/includes/modules/theme-builder/classes/locations-manager.php(307): LaStudioKitThemeBuilder\Modules\ThemeBuilder\Documents\Theme_Document->print_content()
    #34 ../wp-content/plugins/lastudio-element-kit/includes/modules/theme-builder/classes/locations-manager.php(179): LaStudioKitThemeBuilder\Modules\ThemeBuilder\Classes\Locations_Manager->do_location('archive')
    #35 [internal function]: LaStudioKitThemeBuilder\Modules\ThemeBuilder\Classes\Locations_Manager->LaStudioKitThemeBuilder\Modules\ThemeBuilder\Classes\{closure}()
    #36 ../wp-content/plugins/elementor/modules/page-templates/module.php(207): call_user_func(Object(Closure))
    #37 ../wp-content/plugins/elementor/modules/page-templates/templates/header-footer.php(19): Elementor\Modules\PageTemplates\Module->print_content()
    #38 ../wp-includes/template-loader.php(106): include('/Volumes/Busine...')
    #39 ../wp-blog-header.php(19): require_once('/Volumes/Busine...')
    #40 ../index.php(17): require('/Volumes/Busine...')
    #41 {main}
      thrown in ../wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/RestApi.php on line 64
    

    Hi guys,

    I’ve got this error when calling WP Sidebar inside the Elementor and I checked the source code ../wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/RestApi.ph and I found a problem

    $namespace_index variable may return an error ( WP_ERROR ) and in WP_ERROR class there is no get_data() method, that’s why we get the error above

    https://i.ibb.co/N7qNMGX/Screenshot-at-Nov-17-01-08-41.png

    Please check it and solve it.

    Thanks & Regards,
    Jun.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi @choijun

    Thanks for sharing your error logs.

    This kind of error is usually caused by a conflict with your theme or with another plugin. The best way to determine this is to:

    • Temporarily switch your theme to Storefront
    • Disable all plugins except for WooCommerce
    • Repeat the action that is causing the problem

    If you’re not seeing the same behavior after completing the conflict test, then you know the problem was with the plugins and/or theme you deactivated.

    Reactivate the theme first and check again. Then, go on and reactivate your other plugins one by one, testing after each, until you find the one causing conflict.

    You can find a more detailed explanation on how to do a conflict test here:

    https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    Thanks.

    Thread Starter LA-Studio

    (@choijun)

    Hi @rainfallnixfig ,

    I’ve used Storefront theme, WooCommerce and Elementor.

    This is an error of WooCommerce block core api. As I mentioned above, $namespace_index variable may return an error ( WP_ERROR ) and in WP_ERROR class there is no get_data() method – you can see here https://i.ibb.co/N7qNMGX/Screenshot-at-Nov-17-01-08-41.png

    You need to check the validity of the variable before calling the get_data() method.

    Please check it again.

    Thank you.

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    WooCommerce developers do not follow these forums, so if you realized there is an error with the WooCommerce Blocks coding, kindly bring the issue to the attention of the developers so they can have a look at it and provide feedback:

    https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/new/choose

    Thanks!

    Thread Starter LA-Studio

    (@choijun)

    Thanks @rainfallnixfig,

    Let me report this issue on there and hope they will solve it soon.

    Thanks for your help.

    Best Regards,
    Jun.

    Mirko P.

    (@rainfallnixfig)

    Hi Jun @choijun

    Great! Thanks for letting us know.

    Since the thread is now closed I recommend creating a new topic if you have any further questions.

    Have a nice day!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Fatal error: Uncaught Error: Call to undefined method WP_Error::get_data()’ is closed to new replies.