• Resolved chodos

    (@chodos)


    I have a store with WP 4.9.9 and Woo 3.2.6 working and transferred to a local installation to test updates.

    I updated WP to 5.2.1 and continued creating orders, when I updated to Woo 3.6.4 and the database too, the store started to show the error “Can not create order”, only this, no messages with WP_DEBUG active or another log. Then I deactivated all plugins keeping only Woo and changed theme to Storefront, the same problem continue on create order.

    Tried a rollback, bringing Woo to 3.2.6 and create orders worked again, then I tried Woo 3.5.6 and then same problem occurs. Always that is requested to update the database, on change the plugin to a recently version, I do it but problem remains, when I go back to 3.2.6 version with no changes in database the problem not occurs.

    I noticed two things, when go back to 3.2.6 the orders isn’t displayed on admin panel, when I click on Processing or Completed links the orders are listed normally, but on All link nothing is displayed, after update the version and database this works fine.

    When occurs the problem to create order on recently version and I change to older version, the new order created have the product I choose and all the products of the orders that generated error.

    I did the same process with another store, on the same local server, but with Woo from the version 3.4.6 to 3.6.3 and all works fine.

    Can be a problem with database update?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    I would start by locating the source of the error.
    To my knowledge: “Can not create order” is not an error message created by WooCommerce.
    WooCommerce would give you something like: “You do not have permission to create orders”

    Try a full text search for the error message through your root folder and database. Where does the string occur?

    Kind regards,

    Thread Starter chodos

    (@chodos)

    Hi, thank you for your attention.

    Ok, “Can not create order” it’s a direct translation from portuguese. Now I changed the WP’s language to english and the theme for ‘Twenty Nineteen’.

    With Woo 3.2.6 everything works, with 3.6.4 the error message is “Unable to create order.”. I found it on woocommerce/includes/class-wc-checkout.php line 1117.

    Thread Starter chodos

    (@chodos)

    Apparently in Woo 3.6.4 it’s trying to test if order exist and shows the error. On 3.2.6 this test not exist.

    This is the only code included in this snippet of version 3.6.4, but I can not understand why.

    Plugin Support con

    (@conschneider)

    Engineer

    Hi,

    From what I can see the code tries to pass the order data from the form and generate an order post object.

    $order_id = $this->create_order( $posted_data );

    The next order of business is then to retrieve the order data using the order ID.

    $order = wc_get_order( $order_id );

    If no order is found throw this error:

    if ( ! $order ) {
    throw new Exception( __( 'Unable to create order.', 'woocommerce' ) );
    }

    Sounds very much like a conflict if that fails for you. Have you tested with a default theme and only WooCommerce active yet?

    Kind regards,

    Thread Starter chodos

    (@chodos)

    Yes, first I deactivated all the plugins, leaving only WooCommerce and the ‘Twenty Nineteen’ theme active. Now I have removed all the plugins and themes, keeping only WooCommerce and the ‘Twenty Nineteen’ and the problem remains.

    I noticed that upon completing the checkout, entries in the wp_woocommerce_order_items table with order_id 0 are created. I think this can be a problem in generating the ID, in the save() function in woocommerce/includes/class-wc-order.php.

    I do not know why, if there could be some conflict in the database, but it was as far as I could get.

    Thread Starter chodos

    (@chodos)

    I solved the problem based on the solution of topic #11172400.

    After disabling all the plugins, keeping only the WooCommerce and the default theme of WordPress, the problem persisted, which indicated my idea of something wrong in the database.

    Some update, I do not know if WordPress or WooCommerce, should change the length of the column “post_password” in “wp_posts” from varchar(20) to varchar(255), but this did not happen on my installation, either on the local server or on the production server. In other installations this change occurred normally, but in this installation not.

    Based on topic #11172400, I changed the length of the column, in my case I need to change to 191, I could not change to 255 because the collation used is utf8mb4, to collation utf8 should work 255.

    After the change I was able to complete the orders without errors, with tests done in the local server and in the online server.

    I hope this helps in some way.

    Luminus Alabi a11n

    (@luminus)

    Automattic Happiness Engineer

    Hi @chodos,

    I’m glad to hear that you’ve got this sorted.

    I’ll go ahead and mark this topic as resolved now.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Error: Can not create order’ is closed to new replies.