Support » Plugin: Buy one click WooCommerce » Error detected!

  • Resolved lotfreeman

    (@lotfreeman)


    Error detected!

    When the checkbox for writing to the WC table is checked, the “Server error 500”, while it does not go to automatic another page, but a notification is sent email to the buyer and seller by mail.

    Can you fix it?

    Without checking the checkbox in the Woo tables, it works well, but I want to receive orders through WС

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Djo

    (@northmule)

    Please attach the error log from the WooCommerce log, this will help me understand the problem.

    Thread Starter lotfreeman

    (@lotfreeman)

    Plugin Author Djo

    (@northmule)

    /wp-admin/admin.php?page=wc-status&tab=logs
    WooCommerce -> Status -> Jornal (the view button next to the drop-down list)

    Select “fatal_error” from the drop-down list with the desired date and copy those records that coincide with the time of the error.

    Thread Starter lotfreeman

    (@lotfreeman)

    Thanks for your help, we found the bug. This is a conflict with another plugin: BoxBerry
    
    System report, fatal error:
    2023-06-04T01:17:28+00:00 CRITICAL Uncaught TypeError: array_shift(): Argument #1 ($array) must be of type array, null given in wp-content/plugins/boxberry/boxberry-for-woocommerce .php:1203
    Stack trace: 0 wp-content/plugins/boxberry/boxberry-for-woocommerce.php(1203): array_shift(NULL) 1 wp-includes/class-wp-hook.php(310): boxberry_put_choice_code(3854) 2 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) 3 wp-includes/plugin.php(517): WP_Hook->do_action(Array) 4 wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php(103): do_action('woocommerce_new…', 3854, Object(WC_Order)) 5 wp-content/plugins/woocommerce/includes/class-wc-data-store.php(186): WC_Order_Data_Store_CPT->create(Object(WC_Order)) 6 wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php(214): WC_Data_Store->create(Object(WC_Order)) 7 wp-content/plugins/woocommerce/includes/class-wc-order.php(244): WC_Abstract_Order->save() 8 wp-content/plugins/woocommerce/includes/wc-core-functions.php(133): WC_Order->save() 9 wp-content/plugins/buy-one-click-woocommerce/src/Repository/Order.php(63): wc_create_order(Array) 10 wp-content/plugins/buy-one-click-woocommerce/src/Repository/Order.php(181): Coderun\BuyOneClick\Repository\Order->create_order(Array) 11 wp-content/plugins/buy-one-click-woocommerce/src/Controller/OrderController.php(148): Coderun\BuyOneClick\Repository\Order->set_order(Array) 12 wp-includes/class-wp-hook.php(308): Coderun\BuyOneClick\Controller\OrderController->creatingOrder('') 13 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) 14 wp-includes/plugin.php(517): WP_Hook->do_action(Array) 15 wp-admin/admin-ajax.php(188): do_action('wp_ajax_coderun…') 16 {main} thrown in wp-content/plugins/boxberry/boxberry-for-woocommerce.php on line 1203 Can you fix this or contact BoxBerry?
    Plugin Author Djo

    (@northmule)

    Hello! I see that because of the implementation of this plugin, there is only one option to fix this problem. You need to change the file wp-content/plugins/boxberry/boxberry-for-woocommerce.php on line 1203.
    Find the function “function boxberry_put_choice_code($order_id)
    and and prev “$shipping_method = array_shift($_POST[ 'shipping_method' ]);
    add the following code

    if (!isset($_POST[ 'shipping_method' ])) {
    return;
    }

    As a result, the function will look like this:

    function boxberry_put_choice_code($order_id)
    {
    if (!isset($_POST[ 'shipping_method' ])) {
    return;
    }
    $shipping_method = array_shift($_POST[ 'shipping_method' ]);
    $shipping_method_name = preg_replace('/\d+/', '', $shipping_method);
    $array = get_user_meta(get_current_user_id(), '_boxberry_array', true);

    if (isset($_COOKIE['bxb_code'], $_COOKIE['bxb_address'])) {
    update_post_meta($order_id, 'boxberry_code', sanitize_text_field($_COOKIE[ 'bxb_code' ]));
    update_post_meta($order_id, 'boxberry_address', sanitize_text_field($_COOKIE[ 'bxb_address' ]));
    }
    update_user_meta(get_current_user_id(), '_boxberry_array', array ());
    }

    This will solve the problem that you have shown.

    • This reply was modified 8 months, 3 weeks ago by Djo.
    Thread Starter lotfreeman

    (@lotfreeman)

    You are a god!
    Everything worked great, we are in shock 🙂
    Thank you very much for your help, we wish you great success and much joy…
    We are your fans

    Plugin Author Djo

    (@northmule)

    Thanks for the feedback!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Error detected!’ is closed to new replies.