• Resolved krispro

    (@krispro)


    On some woocommerce subscriptions our website runs into the following issue:

    : Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, string given in /var/x/website/html/webroot/public_html/wp-content/plugins/sendcloud-shipping/includes/Models/class-service-point-meta.php:105
    Stack trace:
    
    0 /var/x/website/html/webroot/public_html/wp-content/plugins/sendcloud-shipping/includes/Models/class-service-point-meta.php(105): array_key_exists()
    
    1 /var/x/website/html/webroot/public_html/wp-content/plugins/sendcloud-shipping/includes/Repositories/class-service-point-meta-repository.php(23): Sendcloud\Shipping\Models\Service_Point_Meta::from_array()
    
    2 /var/x/website/html/webroot/public_html/wp-content/plugins/sendcloud-shipping/includes/ServicePoint/class-checkout-handler.php(159): Sendcloud\Shipping\Repositories\Service_Point_Meta_Repository->get()
    
    3 [internal function]: Sendcloud\Shipping\ServicePoint\Checkout_Handler->add_service_point_data_in_admin_order()
    
    4 /var/x/website/html/webroot/public_html/wp-content/plugins/sendcloud-shipping/includes/Utility/class-logging-callable.php(28): call_user_func_array()
    
    5 /var/x/website/html/webroot/public_html/wp-includes/class-wp-hook.php(308): Sendcloud\Shipping\Utility\Logging_Callable->__invoke()
    
    6 /var/x/website/html/webroot/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
    
    7 /var/x/website/html/webroot/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
    
    8 /var/x/website/html/webroot/public_html/wp-content/plugins/woocommerce-subscriptions/includes/admin/meta-boxes/class-wcs-meta-box-subscription-data.php(302): do_action()
    
    9 /var/x/website/html/webroot/public_html/wp-admin/includes/template.php(1445): WCS_Meta_Box_Subscription_Data::output()
    
    10 /var/x/website/html/webroot/public_html/wp-admin/edit-form-advanced.php(688): do_meta_boxes()
    
    11 /var/x/website/html/webroot/public_html/wp-admin/post.php(206): require('/var/hpwsites/u…')
    
    12 {main}
    
    thrown in

    By adjusting the code like this:

        /**
    
         * Creates object from array
    
         *
    
         * @param $data
    
         *
    
         * @return Service_Point_Meta
    
         */
    
        public static function from_array( $data ) {
    
            $service_point = new self();
    
            $service_point->id    = is_array($data) && array_key_exists( 'id', $data ) ? $data['id'] : '';
    
            $service_point->extra = is_array($data) && array_key_exists( 'extra', $data ) ? $data['extra'] : '';
    
            $service_point->post_number = is_array($data) && array_key_exists( 'post_number', $data ) ? $data['post_number'] : '';
    
            return $service_point;
    
        }

    It enables us to be able to view the page again but this issue might have to do with something else. Is this the proper way to fix this or is there a different way (this will be gone on future updates)? and/or what else might be the problem.

    • This topic was modified 2 years, 10 months ago by krispro.
Viewing 1 replies (of 1 total)
  • Plugin Author Sendcloud

    (@sendcloudbv)

    Hi @krispro,

    Sorry to read you’re encountering issues with your WooCommerce subscriptions, and thanks for bringing it to our attention.

    We have a WooCommerce troubleshooting page available in our help center. However, due to the technical nature of your question, could you please open a support ticket so we can fully investigate and help you troubleshoot?

    Thanks for your time,

    Matthew | Technical Support Specialist

    Sendcloud

Viewing 1 replies (of 1 total)

The topic ‘Issue service-point-meta fatal error’ is closed to new replies.