• Resolved mkdsgns

    (@mkdsgns)


    When trying to check out, we are met with the message:

    “There was an error processing your order. Please check for any charges in your payment method and review your order history before placing the order again.”

    I have tried (on staging) to:

    • deactivate all plugins except elementor + pro, woocommerce, square plugin
    • rolling back plugins
    • changing themes

    There are some inconsistencies. Sometimes I can check out and it works, sometimes it doesn’t, there is no pattern though.

    Checkout works when using cash or bank transfer.

    Client’s website is currently offline, so a fast fix would be greatly appreciated.

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @mkdsgns,

    Thank you for reaching out and for providing such a detailed overview of the steps you’ve already taken. I completely understand how frustrating this must be, especially with the issue being inconsistent despite all the effort you’ve put into troubleshooting.

    To help us isolate the cause further, please try deactivating both Elementor and Elementor Pro, switch your theme to Storefront, and enable test mode in WooCommerce Square. Once that’s done, give it another test and let us know so we can run tests on our side as well: https://woocommerce.com/document/woocommerce-square/testing-the-woocommerce-square-extension-in-sandbox-mode/.

    Saw this on Github: https://github.com/woocommerce/woocommerce-square/issues/365 not sure if it is related but I’ll keep it here so I can reference it when we continue troubleshooting your issue.

    Thread Starter mkdsgns

    (@mkdsgns)

    Hello,

    Unable to set Square into test mode currently as I am unable to get access to the clients account. However I switched to storefront and deactivated every plugin apart from Woocommerce and Square, and now met with: “There has been a critical error on this website.”

    As it stands the client has been unable to take orders for 48hrs and about to go into a busy weekend with no website.

    Do you need to see the fatal error logs?

    Thread Starter mkdsgns

    (@mkdsgns)

    I asked chatgpt, and tested on staging and also on live site and it seems to be working. Please see below for anyone that may be encountering this issue…

    🔍 Summary of the Error

    Your WordPress site is encountering a critical error caused by the WooCommerce Square plugin. The issue is:

    TypeError: Unsupported operand types: string + string
    File: /woocommerce-square/includes/Gateway/API/Requests/Orders.php
    Line 292

    This error means the code is attempting to use the + operator on two string values, which is not valid in PHP. In PHP, string concatenation should use the . (dot) operator, not +. 🧱 Root Cause

    The offending file is part of the Square plugin (woocommerce-square) and specifically within this method call stack:

    • Orders->get_api_line_items(...)
    • Orders->set_order_data(...)
    • API->create_order(...)
    • Payment_Gateway_Direct->process_payment(...)

    So when an order is placed (likely during checkout), the plugin tries to construct line items or order data but incorrectly adds two string variables using +. 🔁 Repetition

    This error happens multiple times (09:16, 13:26, 13:28, 13:30), suggesting:

    • It’s affecting multiple customers
    • It hasn’t been resolved between those attempts
    • Likely triggered during every checkout that uses Square

    🛠️ Recommended Fix

    1. Temporary workaround (if urgent):
      • Disable the Square for WooCommerce plugin to restore checkout functionality.
      • Switch to an alternate payment method temporarily.
    2. Permanent fix:
      • Edit /woocommerce-square/includes/Gateway/API/Requests/Orders.php
      • Locate line 292 and replace the + with a . if the intent was string concatenation.
      • Example: phpCopyEdit// Incorrect: $string = $value1 + $value2; // Correct: $string = $value1 . $value2;
    3. Better long-term approach:
      • Update the WooCommerce Square plugin to the latest version (if available).
      • If you’re already on the latest version, report the bug to the plugin developers.

    🧪 How to Investigate Further

    • Open the file at /plugins/woocommerce-square/includes/Gateway/API/Requests/Orders.php
    • Navigate to line 292
    • Inspect the surrounding code to verify what variables are being combined

    If you’d like, I can help write a corrected version of the problematic line if you paste that part of the code here.

    Hi @mkdsgns,

    I completely understand how stressful and overwhelming this situation must have been, especially since it involves a client’s website. I can imagine the pressure you were under, and I’m truly sorry for the inconvenience this caused.

    It’s great to hear that you were able to resolve the issue using ChatGPT, and I really appreciate you sharing the steps you took. While this serves as a temporary solution, I’ll make sure to raise this internally so it can be looked into further, and I’ll follow up with any updates.

    Thank you again for your patience, understanding, and for contributing your insights.

    Plugin Support nicw.a11n

    (@nicw)

    Hi @mkdsgns

    We’ve taken a closer look at where your error is occurring, and we’re worried that your solution is not quite going to do the trick. The problem is this:

    The line of code referenced is this one where Square is adding the $subtotal amount to the $total_tax. As you can see, this is not a string concatenation but actually math.

    At that point in the code, both variables are a float which means the sum should succeed. There should not a string in this calculation.

    The presence of a string indicates an error occurring when either the subtotal or the tax total is fetched.

    We would recommend trying checkout on a default Storefront theme, with the default block or shortcode checkout, with Elementor disabled and only WooCommerce and Square enabled.

    If you’re then still experiencing the issue, you should open a ticket with us at WooCommerce so we can investigate further.

    Plugin Support nicw.a11n

    (@nicw)

    Hi @mkdsgns

    A quick update for you: this has been narrowed down to a problem which occurs when a $0 value local pickup shipping item is in the cart. Our developers have created a fix, which you can see here. and included it in the latest release, 4.9.4, from two days ago. I hope this has solved the issue for you.

    Plugin Support Chris Moreira – a11n

    (@chrism245)

    I’m going to mark this as resolved, as we didn’t receive any update on this. We’ll be here if and/or when you are ready to continue.

    If you have a few minutes, we’d love if you could leave us a review: https://ww.wp.xz.cn/support/plugin/woocommerce-square/reviews/

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘“There was an error processing your order.”’ is closed to new replies.