• Hello, in advance i want to thank you for your help. I want to integrate woocommerce addresses, orders and payment methods tabs to memberpress nav-tab in account page. So i create a shortcode to display the tabs in the memberpress account page and i paste the shortcode in Account Nav Tabs. At first it works perfectly it also display the informations and i could edit or add the addresses and after a while it stops and display a fatal error when i press edit or add. I try to deactivate and activate the plugins again but nothing change, i use the storefront theme and when i press edit it shows page not found.

    • This topic was modified 2 years, 8 months ago by jimdaou.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hello,

    Please head to WooCommerce > status > tools. Look for the option Update database.

    Also, please navigate to WooCommerce > status > scheduled actions > pending. Run the pending actions and allow some time, then check again if the issue persists.

    Thread Starter jimdaou

    (@jimdaou)

    Hello,

    I did all that but the problem still persists.

    Thread Starter jimdaou

    (@jimdaou)

    i use hello elementor theme

    Moderator bcworkz

    (@bcworkz)

    Without seeing what your shortcode does there’s little hope that anyone can help you. If you’re willing to share the source code, someone might be willing to take a closer look, but since it’s related to WooCommerce and MemberPress, you might be better off asking in their dedicated support forums where its devs and expert users are in the best position to help you.

    If your source code is more than a dozen or so lines, please do not post directly in these forums. Instead post somewhere like gist.github.com or pastebin.com and only provide the link in your topic.

    It’ll also be helpful to see the backtrace for the fatal error so we have a better idea of the root cause. We need to know where the empty path is coming from.

    Thread Starter jimdaou

    (@jimdaou)

    the code for addresses is

    function display_custom_addresses_tab() {
    ob_start();
    wc_get_template( ‘myaccount/my-address.php’ );
    return ob_get_clean();
    }
    add_shortcode( ‘woocommerce_addresses’, ‘display_custom_addresses_tab’ );

    and similar for orders and payment methods

    • This reply was modified 2 years, 8 months ago by jimdaou.
    Thread Starter jimdaou

    (@jimdaou)

    the fatal error

    PHP Fatal error: Uncaught ValueError: Path cannot be empty in /home/skgeduca/domains/staging.skg.education/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php:53\nStack trace:\n#0 /home/skgeduca/domains/staging.skg.education/public_html/wp-includes/class-wp-hook.php(310): wc_template_redirect()\n#1 /home/skgeduca/domains/staging.skg.education/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()\n#2 /home/skgeduca/domains/staging.skg.education/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()\n#3 /home/skgeduca/domains/staging.skg.education/public_html/wp-includes/template-loader.php(13): do_action()\n#4 /home/skgeduca/domains/staging.skg.education/public_html/wp-blog-header.php(19): require_once(‘…’)\n#5 /home/skgeduca/domains/staging.skg.education/public_html/index.php(17): require(‘…’)\n#6 {main}\n thrown in /home/skgeduca/domains/staging.skg.education/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 53\n

    Moderator bcworkz

    (@bcworkz)

    As it happens your shortcode is not useful in the way I thought it would be. And since the code that executes by pressing Edit is largely through filter and action hooks, the backtrace is not very informative either. Thanks for posting the requested information anyway.

    What version of WC do you use? Line 53 of the latest wc-template-functions.php is not looking for a path, empty or not:
    include get_query_template( '404' );

    It is however related to returning a 404 page not found response. Probably if you are able to avoid the not found error, there would be no fatal error either?

    Why is there a 404 not found error? IDK, sorry. Probably because the my-address.php template is being loaded out of its expected context. I recommend asking in the WooCommerce dedicated support forum where those who actually know the inner workings of WooCommerce are in a better position to help you with this.

    Thread Starter jimdaou

    (@jimdaou)

    i use the latest version 8.1.1. Yes, line 53 it’s the line you wrote. Thank you!!!

    Moderator bcworkz

    (@bcworkz)

    Well, that’s strange. get_query_template() should always return some sort of theme template path, it should never be an empty return value. If your theme has no 404 template, something else within the template hierarchy should be returned. Every theme has at least one template file that is in the hierarchy.

    I know you tried with no plugins. Have you also tried with a different theme such as one of the Twenty* default themes? Something could be amiss with your Storefront theme.

    In any case, as I said, the error relates to trying to respond with a 404 status. Correct the 404 issue and the related error will not occur. If the edit and add links from your shortcode still result in a 404 response with no plugins but WooCommerce active and while a default theme is active, the WooCommerce dedicated support forum is the best place to seek further advice. Naturally for such a test you would need to temporarily move your shortcode handler function to the currently active theme’s functions.php file.

    Thread Starter jimdaou

    (@jimdaou)

    With twenty theme displays the same error and with storefront theme it displays page not found.

    • This reply was modified 2 years, 8 months ago by jimdaou.
    • This reply was modified 2 years, 8 months ago by jimdaou.
Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Path cannot be empty in woocommerce/includes/wc-template-functions.php:53’ is closed to new replies.