• Resolved dev

    (@devksec)


    Hello,

    We’ve had a large number of issues when moving a subsite to standalone installation. The store is a woocommerce store and most of the plugins settings were lost and had to be reconfigured.

    Currently we have the following unresolved issues:
    1. Woocommerce orders are unlinked to user accounts (When viewing an order the user account is not associated)

    Plugins which settings were lost or not working:
    1. Wordfence – Had to be reset/lost settings & license
    2. Ithemes security – Had to be reset/lost settings
    3. Total cache – Setting corrupted and caused errors, had to be reset
    4. WP DB Cleaner pro – Lost cleaning schedules and license
    5. Yoast SEO – lost license
    6. WP Activity log – Setting corrupted and caused errors, had to be uninstalled/reinstalled and clean settings
    7. Kirki customiser – had to be uninstalled/reinstalled as fonts were lost
    8. Compliaz – had to be resetup
    9. Media cloud – Freemius broke and got stuck in setup loop. Uninstalled re-installed
    10. Mycrypto Checkout – broke account setup. Uninstalled re-installed
    11. wp-lister – Lost account settings (had to be refreshed)
    12. automatic plugin updates – update settings would not save and were lost. Uninstalled re-installed
    14. Login No captcha recaptcha – SQL error causing deadlock SELECT * FROMwp_optionsWHEREoption_name= 'login_nocaptcha_working';

    The most important one is the woocommerce orders. The rest we have resolved manually.

    Any help would be appreciated.

Viewing 15 replies - 1 through 15 (of 42 total)
  • Plugin Author Codexonics

    (@codexonics)

    Hi Dev,
    Thanks for using Prime Mover in your project! Sorry to hear you have migration issues. Regarding the unresolved issue on WooCommerce orders – it’s tricky one and we have reproduced this one in our test server.

    The issue is that the when the user is migrated to standalone – a different user ID is created because Prime Mover relies on wp_insert_user for new migrating new users to the site.

    When the new user migrated ID is different from the original customer ID (at multisite source) – then the WooCommerce order is disconnected from the original user at standalone.
    To fix this and to re-align the customer IDs with the migrated user IDs. Can you please try the steps below:

    1. Download this custom hotfix plugin.
    2. Install this to your standalone site and make sure WooCommerce plugin is activated.
    3. Now activate the plugin – “Migrate customer ID WC Orders
    4. Depending on the number of WooCommerce orders, this can take time to loop over it to update the customer orders.
    5. You will know it’s done updating when the plugin is finally activated. If server timeout is reached – increase your server timeout and simply re-activate the plugin.
    6. Make sures to deactivate the plugin after this.

    This should re-align the customer IDs associated with the WooCommerce order with the new user IDs migrated at the standalone site.

    If you are still having issues with this – please provide us the download link of the WPRIME package used to migrate to standalone by contacting us here. We will debug your package further to see what’s wrong.

    If this works successfully – we will add a permanent fix to this issue inside Prime Mover plugin in the future releases. Thanks again for reporting this issue. Please mark this ticket as resolved if you don’t anymore need technical assistance. Cheers.

    Thread Starter dev

    (@devksec)

    Hello,

    Thanks for getting back to me.

    The plugin just activates instantly. Is there a way to debug this or get a log written ? It doesn’t seem to run.

    Many Thanks !

    Plugin Author Codexonics

    (@codexonics)

    Hi Dev,
    I’ve modified the hotfix to write some logs. Please re-download it here. It’s version 2.0 so make sure you install this.

    And then please enable WordPress debug first in your standalone site before activating this hotfix:

    
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true);
    

    Once debugging is enabled, activate the hotfix plugin. Once done – it will automatically deactivate. The log should be written to /wp-content/debug.log contains sensitive information and don’t post it publicly.

    Please send it to us by logging into the standalone site and go to Prime Mover – Contact Us or you can send us via our contact form here.

    The hotfix relies on customer billing email. If this is not set or not associated with a WP user , then the hotfix will not work.

    Alternatively (if hot fix does not work) – during the time when you migrate the site to standalone. Prime Mover writes migration logs to ‘/wp-content/uploads/prime-mover-export-files/’ , search for file name with something like XXXXXX_migration.log as the filename. Only check the latest restore log. You don’t need to restore the site again to your standalone as this migration log should already exist there.

    Download and open the log and look for the user equivalence log. It should look something like this:

    `
    [user_equivalence] => SplFixedArray Object
    (
    [0] =>
    [1] => 3
    [2] => 4
    )

    This log is important because it shows the user ID before (in your multisite source site) and after (in your target standalone) migration. For example in the above sample log. User ID 1 becomes User ID 3 at target site. User ID 2 becomes User ID 4 at target site. You can use this information to manually adjust the _customer_user meta_key associated with that WC order.

    We are now well aware of this issue and will be working on a permanent fix so they will automatically adjusted when migrating WC sites.

    Our support timezone is GMT + 8 so in case you have follow-up questions. We will check on it with details on the next day. Thank you!

    • This reply was modified 4 years, 1 month ago by Codexonics. Reason: Some typo
    Thread Starter dev

    (@devksec)

    Ok so the logging shows the plugin works past the ones we have manually set, however the first order it fails and then stops processing. Here is the redacted one, let me know if you still need the full log.

    [08-Feb-2022 14:54:28 UTC] NO USER ASSOCIATED WITH THIS BILLING EMAIL, BAIL OUT DONT PROCESS.
    [08-Feb-2022 14:54:28 UTC] ORDER ID: 9684
    [08-Feb-2022 14:54:28 UTC] BILLING EMAIL: <<Redacted>>
    [08-Feb-2022 14:54:28 UTC] ORIGINAL CUSTOMER ID: 0
    [08-Feb-2022 14:54:28 UTC] GET USER INFO BY BILLING EMAIL.
    [08-Feb-2022 14:54:28 UTC] NO USER ASSOCIATED WITH THIS BILLING EMAIL, BAIL OUT DONT PROCESS.
    [08-Feb-2022 14:54:28 UTC] DONE PROCESSING

    I’ve checked this order and it was purchased as a guest. So it looks like the plugin needs some code to detect/handle and skip guest purchases, then it should be ok?

    Plugin Author Codexonics

    (@codexonics)

    Thanks for the update. Yes it looks like it but we will do some more testing on this aspect regarding guest purchases, etc. If you can send me the full log in your end that would be great so we will know how it processes the entire order set.

    We did some test on the hotfix and it correctly detects guest purchases and customers with account. For example this is a full log:

    [08-Feb-2022 15:29:00 UTC] Retrieving all orders
    [08-Feb-2022 15:29:00 UTC] Processing order
    [08-Feb-2022 15:29:00 UTC] ORDER ID: 16
    [08-Feb-2022 15:29:00 UTC] BILLING EMAIL: xxx
    [08-Feb-2022 15:29:00 UTC] ORIGINAL CUSTOMER ID: 3
    [08-Feb-2022 15:29:00 UTC] GET USER INFO BY BILLING EMAIL.
    [08-Feb-2022 15:29:00 UTC] MIGRATED USER ID: 5
    [08-Feb-2022 15:29:00 UTC] UPDATING CUSTOMER ID ASSOCIATED WITH ORDER ID 16 WITH USER ID: 5
    [08-Feb-2022 15:29:00 UTC] ORDER ID: 15
    [08-Feb-2022 15:29:00 UTC] BILLING EMAIL: xxx
    [08-Feb-2022 15:29:00 UTC] ORIGINAL CUSTOMER ID: 0
    [08-Feb-2022 15:29:00 UTC] GET USER INFO BY BILLING EMAIL.
    [08-Feb-2022 15:29:00 UTC] MIGRATED USER ID: 3
    [08-Feb-2022 15:29:00 UTC] UPDATING CUSTOMER ID ASSOCIATED WITH ORDER ID 15 WITH USER ID: 3
    [08-Feb-2022 15:29:00 UTC] ORDER ID: 14
    [08-Feb-2022 15:29:00 UTC] BILLING EMAIL: xxx
    [08-Feb-2022 15:29:00 UTC] ORIGINAL CUSTOMER ID: 0
    [08-Feb-2022 15:29:00 UTC] GET USER INFO BY BILLING EMAIL.
    [08-Feb-2022 15:29:00 UTC] NO USER ASSOCIATED WITH THIS BILLING EMAIL, BAIL OUT DONT PROCESS.
    [08-Feb-2022 15:29:00 UTC] ORDER ID: 12
    [08-Feb-2022 15:29:00 UTC] BILLING EMAIL: xxx
    [08-Feb-2022 15:29:00 UTC] ORIGINAL CUSTOMER ID: 2
    [08-Feb-2022 15:29:00 UTC] GET USER INFO BY BILLING EMAIL.
    [08-Feb-2022 15:29:00 UTC] MIGRATED USER ID: 4
    [08-Feb-2022 15:29:00 UTC] UPDATING CUSTOMER ID ASSOCIATED WITH ORDER ID 12 WITH USER ID: 4
    [08-Feb-2022 15:29:00 UTC] DONE PROCESSING

    There are 4 orders total in the above test and 4 customers. 2 are guest purchases and 2 users with accounts. After running the script/hotfix – the orders are re-aligned for those customers with accounts at the target standalone site.

    I think you should have all the information you need to make this adjustment in your end. Also you can restore the site again to standalone Prime Mover and then re-run the hotfix script plugin to make sure you are getting consistent results. Please let me know if you still need help or assistance.

    Thread Starter dev

    (@devksec)

    There are about 1700 orders, the plugin stops at the second guest (not first) so something isn’t working as expected.

    I’ve sent the full log as requested, but the plugin as of the moment is not working. It gets to the second problematic order and then stops E.G:

    [08-Feb-2022 14:54:28 UTC] ORDER ID: 9687
    [08-Feb-2022 14:54:28 UTC] BILLING EMAIL: <<redacted>>
    [08-Feb-2022 14:54:28 UTC] ORIGINAL CUSTOMER ID: 505
    [08-Feb-2022 14:54:28 UTC] GET USER INFO BY BILLING EMAIL.
    [08-Feb-2022 14:54:28 UTC] MIGRATED USER ID: 505
    [08-Feb-2022 14:54:28 UTC] MIGRATED USER ID IS ALREADY THE SAME WITH CUSTOMER ID.
    [08-Feb-2022 14:54:28 UTC] ORDER ID: 9685
    [08-Feb-2022 14:54:28 UTC] BILLING EMAIL: <<redacted>>
    [08-Feb-2022 14:54:28 UTC] ORIGINAL CUSTOMER ID: 0
    [08-Feb-2022 14:54:28 UTC] GET USER INFO BY BILLING EMAIL.
    [08-Feb-2022 14:54:28 UTC] NO USER ASSOCIATED WITH THIS BILLING EMAIL, BAIL OUT DONT PROCESS.
    [08-Feb-2022 14:54:28 UTC] ORDER ID: 9684
    [08-Feb-2022 14:54:28 UTC] BILLING EMAIL: <<redacted>>
    [08-Feb-2022 14:54:28 UTC] ORIGINAL CUSTOMER ID: 0
    [08-Feb-2022 14:54:28 UTC] GET USER INFO BY BILLING EMAIL.
    [08-Feb-2022 14:54:28 UTC] NO USER ASSOCIATED WITH THIS BILLING EMAIL, BAIL OUT DONT PROCESS.
    [08-Feb-2022 14:54:28 UTC] DONE PROCESSING
    • This reply was modified 4 years, 1 month ago by dev.
    Plugin Author Codexonics

    (@codexonics)

    Thanks, that is strange indeed. It would be hard to debug/reproduce this without looking at your WPRIME package. Can you please share the original WPRIME package in Gdrive or any file share host and then send me the link to download it? We will check your package in our local to reproduce this issue.

    Once we got your package – please give us time to analyze. Thanks again.

    Thread Starter dev

    (@devksec)

    Because of the data in it, there is no way to sanitize it for data protection or scrub non relevant data.

    Would the migration logs, specific to [user_equivalence] => SplFixedArray Object, help once redacted?

    Thread Starter dev

    (@devksec)

    I’ve re-activated the plugin and the results are the same. It runs though the 10 most recent and stop.

    I made reduced the lines of code just to log the order IDS within debug.log

    and the result was this

    [08-Feb-2022 16:43:38 UTC] Retrieving all orders
    [08-Feb-2022 16:43:38 UTC] Processing order
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9761
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9743
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9694
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9692
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9691
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9690
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9689
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9687
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9685
    [08-Feb-2022 16:43:38 UTC] ORDER ID: 9684
    [08-Feb-2022 16:43:38 UTC] DONE PROCESSING

    For some reason, this code is only getting the last 10:

    $orders = wc_get_orders( $args );
        
        primeMoverWriteLog("Processing order");
        foreach ($orders as $order) {
            
            $order_id = $order->get_id();        
            primeMoverWriteLog("ORDER ID: $order_id");
        }
    Plugin Author Codexonics

    (@codexonics)

    Hi Dev, Yes that’s fine, also the user equivalence log is redacted. We are currently reviewing the hotfix plugin script so make sure it works for all orders not only the 10 most recent ones. I’ll update here again when this is ready. Thanks!

    Plugin Author Codexonics

    (@codexonics)

    OK, the hotfix plugin script is now updated. To re-test:

    • Backup your existing standalone site database.
    • Download the latest hotfix plugin script.
    • Install the hotfix plugin script to your standalone site.
    • Make sure the hotfix plugin script is version 3.0.
    • Make sure WooCommerce plugin is activated.
    • Delete old /wp-content/debug.log so that the log file contains the latest logs only.
    • Make sure WordPress debugging is enabled in wp-config.php.
    • 
      define( 'WP_DEBUG', true );
      define( 'WP_DEBUG_LOG', true);
      
    • Activate the hotfix plugin Migrate customer ID WC Orders
    • Wait until the plugin is fully activated. When it does – check the logs for details and results. The log shows the total number of orders processed and all other details. It should process more than 10 orders now.
    • Backup your debug.log so you will see the progress of the orders updating just in case you need to re-run it again if it hits timeout. This way we can tweak where to resume.
    • Once done, check the customer accounts – orders should be connected.

    That’s it 🙂 Hope this fix resolves your issue. Thanks!

    Thread Starter dev

    (@devksec)

    So some progress, it now processes all orders. However it has incorrectly marked all of the disconnected orders as guest purchases when a user account exists with the same email billing has.

    We cleared up and removed all failed orders over the last 2 years so all are completed orders.

    [09-Feb-2022 12:16:56 UTC] DONE PROCESSING 5 ORDERS - WE GO TO THE NEXT 5 ORDERS...
    [09-Feb-2022 12:16:56 UTC] NO MORE ORDERS TO PROCESSED.
    [09-Feb-2022 12:16:56 UTC] DONE PROCESSING ALL WOOCOMMERCE ORDERS.
    [09-Feb-2022 12:16:56 UTC] THERE ARE AROUND 1620 ORDERS PROCESSED.
    [09-Feb-2022 12:16:56 UTC] DEACTIVATING HOTFIX PLUGIN SCRIPT...

    Order #9588 for example has a user account with the billing email. Log shows:

    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9588
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9588 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE

    The latest script is marking all orders as guest, luckily this was in staging.

    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9630 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] DONE PROCESSING 5 ORDERS - WE GO TO THE NEXT 5 ORDERS...
    [09-Feb-2022 12:16:51 UTC] Processing 5 orders for page 7
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9629
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9629 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9628
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9628 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9606
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9606 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9604
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9604 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9603
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9603 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] DONE PROCESSING 5 ORDERS - WE GO TO THE NEXT 5 ORDERS...
    [09-Feb-2022 12:16:51 UTC] Processing 5 orders for page 8
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9601
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9601 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9600
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9600 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9599
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9599 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9588
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9588 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9584
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9584 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] DONE PROCESSING 5 ORDERS - WE GO TO THE NEXT 5 ORDERS...
    [09-Feb-2022 12:16:51 UTC] Processing 5 orders for page 9
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9580
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9580 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9576
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9576 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9575
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9575 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9574
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9574 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] PROCESSING ORDER
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9569
    [09-Feb-2022 12:16:51 UTC] ORDER ID: 9569 IS ASSOCIATED WITH GUEST PURCHASE, _customer_user = 0. UPDATING DATABASE
    [09-Feb-2022 12:16:51 UTC] DONE PROCESSING 5 ORDERS - WE GO TO THE NEXT 5 ORDERS...
    Plugin Author Codexonics

    (@codexonics)

    Thanks for the update. Glad to know it now processes all orders! By the way, that is weird to incorrectly detect guest purchase. It’s using the WC Order::get_user() which will return a user object and false for guests.

    Moving forward with this – how about we check if every order has associated billing email. Then once that billing email is set – we query the WP_User table if a user exist with that given billing email. If user exist in users table for that billing email – WC account exists.

    Then we get the migrated user ID and use it to update _customer_user in post meta table for that order. Otherwise if user does not exist with the given billing email or if this billing email is not set in the order – we mark that as a guest order and set _customer_user to 0.

    Do you think this works for your case? We don’t have the package or db to test but we can propose some solutions to this. Thanks.

    Plugin Author Codexonics

    (@codexonics)

    OK just in case you want to test. The hotfix plugin script is modified to version 4.0. It’s now very simple – it simply checks for billing email and if user account exists. If it does – get the migrated user ID and set it to customer ID meta key for that order. For guest checkouts where customer ID is already 0 – it’s skipped.

    To re-test – please restore to the original dB backup state first. Clear the debug.log. You can then install and activate hotfix plugin version 4.0.

    Thanks and let me know if you still need assistance.

    Thread Starter dev

    (@devksec)

    Doesn’t work as of yet however is nearly there.

    It does a first load of orders and does appear to fix them. However it then loops back and tries to redo the same orders but then breaks and stops with no proper logs.

    Sent the whole load via the contact form.

Viewing 15 replies - 1 through 15 (of 42 total)

The topic ‘Various issues with migration’ is closed to new replies.