• Resolved hebhansen

    (@hebhansen)


    Hi

    I see this error in debug mode:

    [03-Apr-2026 14:59:38 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get_cross_sells() on null in /site/public_html/wp-content/plugins/hide-category-by-user-role-for-woocommerce/public/public-ui-setup.php:477
    Stack trace:
    #0 /site/public_html/wp-includes/class-wp-hook.php(343): tswchc_customize_cross_sell_products_block(NULL, Array)
    #1 /site/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(NULL, Array)
    #2 /site/public_html/wp-includes/class-wp-block.php(555): apply_filters('pre_render_bloc...', NULL, Array, Object(WP_Block))
    #3 /site/public_html/wp-includes/class-wp-block.php(579): WP_Block->render()
    #4 /site/public_html/wp-includes/class-wp-block.php(579): WP_Block->render()
    #5 /site/public_html/wp-includes/blocks.php(2383): WP_Block->render()
    #6 /site/public_html/wp-includes/blocks.php(2466): render_block(Array)
    #7 /site/public_html/wp-includes/class-wp-hook.php(341): do_blocks('<!-- wp:woocomm...')
    #8 /site/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters('<!-- wp:woocomm...', Array)
    #9 /site/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1972): apply_filters('the_content', '<!-- wp:woocomm...')
    #10 /site/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(476): WP_REST_Posts_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request))
    #11 /site/public_html/wp-includes/rest-api/class-wp-rest-server.php(1292): WP_REST_Posts_Controller->get_items(Object(WP_REST_Request))
    #12 /site/public_html/wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/pages', Array, NULL)
    #13 /site/public_html/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request))
    #14 /site/public_html/wp-includes/rest-api.php(467): WP_REST_Server->serve_request('/wp/v2/pages')
    #15 /site/public_html/wp-includes/class-wp-hook.php(341): rest_api_loaded(Object(WP))
    #16 /site/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters(NULL, Array)
    #17 /site/public_html/wp-includes/plugin.php(570): WP_Hook->do_action(Array)
    #18 /site/public_html/wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array)
    #19 /site/public_html/wp-includes/class-wp.php(821): WP->parse_request('')
    #20 /site/public_html/wp-includes/functions.php(1343): WP->main('')
    #21 /site/public_html/wp-blog-header.php(16): wp()
    #22 /site/public_html/index.php(17): require('/site/...')
    #23 {main}
    thrown in /site/public_html/wp-content/plugins/hide-category-by-user-role-for-woocommerce/public/public-ui-setup.php on line 477
    • This topic was modified 2 months, 1 week ago by hebhansen.
Viewing 1 replies (of 1 total)
  • Plugin Author ThemeSupport

    (@themesupport)

    Thank you for bringing this to our attention.

    We’ve pushed the fix in the new 2.4 version of the plugin.

    This new version addresses the issues you reported and also includes the following improvements:

    • Prevents direct URL access to hidden products based on category/role rules.
    • Centralized visibility logic to ensure consistent behavior across all critical points.
    • Parent category (hierarchy) validation to prevent restricted products from appearing through indirect relationships.
    • Consistent validation in the add-to-cart process to block hidden products from being added to the cart.
    • Automatic cart cleanup to remove products that are no longer allowed under active rules.
    • Improved handling of restricted access using configurable modes: redirect (URL) or custom message (display-message).
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.