• amlr

    (@amlr)


    Packlink causes a crash on the checkout page of my online store.

    This happens when a customer, who enters as a ‘guest’ and hasn’t added their shipping address, adds a product to the cart and clicks on checkout. The checkout page crashes immediately, and nothing can be done.

    If this customer already has their address entered in the system, the page displays correctly, including the prices. The problem is that the checkout page is precisely where they need to enter their address. I’ve resolved it by downgrading to version 3.3.4, but I consider it risky to use this version.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter amlr

    (@amlr)

    As I see the entire development team very concerned about the issue, below is a copy of the error message I am receiving. This error was obtained by running a local copy of my website to avoid affecting the live server, but it is the same error in the real environment:

    Fatal error: Uncaught TypeError: reset(): Argument #1 ($array) must be of type array, string given in C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\packlink-pro-shipping\Components\Checkout\class-block-checkout-handler.php:181 Stack trace: #0 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\packlink-pro-shipping\Components\Checkout\class-block-checkout-handler.php(181): reset(”) #1 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\packlink-pro-shipping\Components\Checkout\class-block-checkout-handler.php(91): Packlink\WooCommerce\Components\Checkout\Block_Checkout_Handler->get_selected_shipping_method() #2 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\class-wp-hook.php(324): Packlink\WooCommerce\Components\Checkout\Block_Checkout_Handler->checkout_update_drop_off(Object(WC_Order)) #3 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\class-wp-hook.php(348): WP_Hook->apply_filters(”, Array) #4 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\plugin.php(517): WP_Hook->do_action(Array) #5 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\woocommerce\src\StoreApi\Routes\V1\Checkout.php(415): do_action(‘woocommerce_sto…’, Object(WC_Order)) #6 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\woocommerce\src\StoreApi\Routes\V1\Checkout.php(166): Automattic\WooCommerce\StoreApi\Routes\V1\Checkout->create_or_update_draft_order(Object(WP_REST_Request)) #7 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\woocommerce\src\StoreApi\Routes\V1\AbstractRoute.php(126): Automattic\WooCommerce\StoreApi\Routes\V1\Checkout->get_route_response(Object(WP_REST_Request)) #8 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\woocommerce\src\StoreApi\Routes\V1\Checkout.php(136): Automattic\WooCommerce\StoreApi\Routes\V1\AbstractRoute->get_response_by_request_method(Object(WP_REST_Request)) #9 [internal function]: Automattic\WooCommerce\StoreApi\Routes\V1\Checkout->get_response(Object(WP_REST_Request)) #10 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\woocommerce\src\Blocks\Domain\Services\Hydration.php(155): call_user_func_array(Array, Array) #11 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\woocommerce\src\Blocks\Domain\Services\Hydration.php(65): Automattic\WooCommerce\Blocks\Domain\Services\Hydration->get_response_from_controller(‘Automattic\WooC…’, ‘/wc/store/v1/ch…’) #12 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\woocommerce\src\Blocks\Assets\AssetDataRegistry.php(340): Automattic\WooCommerce\Blocks\Domain\Services\Hydration->get_rest_api_response_data(‘/wc/store/v1/ch…’) #13 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\woocommerce\src\Blocks\Assets\AssetDataRegistry.php(269): Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry->Automattic\WooCommerce\Blocks\Assets{closure}() #14 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\plugins\woocommerce\src\Blocks\Assets\AssetDataRegistry.php(385): Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry->execute_lazy_data() #15 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\class-wp-hook.php(324): Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry->enqueue_asset_data(”) #16 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\class-wp-hook.php(348): WP_Hook->apply_filters(”, Array) #17 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\plugin.php(517): WP_Hook->do_action(Array) #18 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\script-loader.php(2246): do_action(‘wp_print_footer…’) #19 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\class-wp-hook.php(324): wp_print_footer_scripts(”) #20 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #21 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\plugin.php(517): WP_Hook->do_action(Array) #22 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\general-template.php(3081): do_action(‘wp_footer’) #23 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\themes\kadence\footer.php(38): wp_footer() #24 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\template.php(810): require_once(‘C:\Users\user\…’) #25 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\template.php(745): load_template(‘C:\Users\user\…’, true, Array) #26 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\general-template.php(92): locate_template(Array, true, true, Array) #27 C:\Users\user\Local Sites\”Websitename”\app\public\wp-content\themes\kadence\page.php(22): get_footer() #28 C:\Users\user\Local Sites\”Websitename”\app\public\wp-includes\template-loader.php(106): include(‘C:\Users\user\…’) #29 C:\Users\user\Local Sites\”Websitename”\app\public\wp-blog-header.php(19): require_once(‘C:\Users\user\…’) #30 C:\Users\user\Local Sites\”Websitename”\app\public\index.php(17): require(‘C:\Users\user\…’) #31 {main} thrown in C:\Users\user**\Local Sites\”Websitename”\app\public\wp-content\plugins\packlink-pro-shipping\Components\Checkout\class-block-checkout-handler.php on line 181

    There has been a critical error on this website.

    I get the same error for all versions 3.4.X. I recall that version 3.3.4 works correctly.

    Thank you very much

    Similar error in all 3.4.X versions
    Error parecido en todas las versiones 3.4.X

    PHP Fatal error: Uncaught Error: Class "Packlink\WooCommerce\Components\Order\Paid_Order_Handler" not found in /srv/htdocs/wp-content/plugins/packlink-pro-shipping/class-plugin.php:620 Stack trace: #0 /wordpress/core/6.6.1/wp-includes/class-wp-hook.php(324): Packlink\WooCommerce\Plugin::Packlink\WooCommerce\{closure}('') #1 /wordpress/core/6.6.1/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #2 /wordpress/core/6.6.1/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /wordpress/plugins/woocommerce/9.2.3/includes/class-woocommerce.php(841): do_action('woocommerce_ini...') #4 /wordpress/core/6.6.1/wp-includes/class-wp-hook.php(324): WooCommerce->init('') #5 /wordpress/core/6.6.1/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #6 /wordpress/core/6.6.1/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #7 /wordpress/core/6.6.1/wp-settings.php(700): do_action('init') #8 /srv/htdocs/wp-config.php(81): require_once('/wordpress/core...') #9 /wordpress/core/6.6.1/wp-load.php(55): require_once('/srv/htdocs/wp-...') #10 /wordpress/core/6.6.1/wp-blog-header.php(13): require_once('/wordpress/core...') #11 /wordpress/core/6.6.1/index.php(17): require('/wordpress/core...') #12 {main} thrown in /srv/htdocs/wp-content/plugins/packlink-pro-shipping/class-plugin.php on line 620

    Marca temporal

    2024-09-09T10:03:28.000Z

    Tipo

    plugins

    Nombre

    packlink-pro-shipping

    Archivo

    /srv/htdocs/wp-content/plugins/packlink-pro-shipping/class-plugin.php

    Línea

    620

    Installing a version 3.3.4 does not happen.
    Instalando una versión 3.3.4 no ocurre.

    Solution?
    ?Solución?

    Thread Starter amlr

    (@amlr)

    Good morning,

    I’m sure the Packlink development team is working tirelessly to fix this bug, but just in case, I passed the plugin to ChatGPT, and it resolved the issue. Below is the link to the solution:
    https://chatgpt.com/share/66ffcce7-b18c-8010-8268-e3fe3f9c848d

    In case it’s still too much effort to follow the link to check it out, here is the exact line of code that needs to be changed in the file: “class-block-checkout-handler.php” (located in packlink-pro-shipping\Components\Checkout).

    In version 3.4.12 of Packlink, on line 181 (opening it with Notepad), you should change the line:

    return explode( ':', reset( $chosen_shipping_methods ) )[1];

    To this:

    if (is_array($chosen_shipping_methods) && !empty($chosen_shipping_methods)) {
        $shipping_method = reset($chosen_shipping_methods);
        if (is_string($shipping_method)) {
            $exploded_method = explode(':', $shipping_method);
            if (isset($exploded_method[1])) {
                return $exploded_method[1];
            }
        }
    }
    return ''; // Default value if conditions are not met

    This should fix the issue. I hope the Packlink team can incorporate this fix into the code.

    Thank you very much.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.