• Resolved cutu234

    (@cutu234)


    A customer has just complained that the customer data (checkout form) are not saved after changing something on the cart page (user is not logged in). I can reproduce the problem on my staging server with just Storefront installed. While the address is saved in the session, Name, email, telephone etc. are not.

    I can easily fix this with this snippet:

    add_action( 'woocommerce_checkout_update_order_review', 'custom_preserve_all_checkout_fields_in_session' );
    function custom_preserve_all_checkout_fields_in_session( $post_data ) {
        parse_str( $post_data, $post_array );
        $prefixes = array( 'billing_', 'shipping_' );
        $fields   = array(
            'first_name', 'last_name', 'company', 'country', 
            'address_1', 'address_2', 'postcode', 'city', 
            'state', 'phone', 'email'
        );
        foreach ( $prefixes as $prefix ) {
            foreach ( $fields as $field ) {
                $full_field_key = $prefix . $field;
    
                if ( isset( $post_array[ $full_field_key ] ) ) {
                    $method_name = 'set_' . $full_field_key;
                    if ( is_callable( array( WC()->customer, $method_name ) ) ) {
                        $value = sanitize_text_field( $post_array[ $full_field_key ] );
                        WC()->customer->$method_name( $value );
                    }
                }
            }
        }
    }

    However, what’s the idea behind it? I understand that Woocommerce needs the address for calculating the shipping fee. But this is a major problem in terms of user experience.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi @cutu234,

    Thank you for reaching out.

    I understand your concern. From your description, it sounds like when a guest customer updates something on the cart page, the checkout form no longer retains certain fields such as the customer’s name, email address, and phone number, while the address fields are still preserved. I also understand that you’ve been able to reproduce the issue on your staging site using only the Storefront theme.

    To help us investigate further, could you please provide a few more details?

    • Could you share the exact steps to reproduce the issue from start to finish?
    • What changes are being made on the cart page before returning to the checkout (for example, updating the quantity, applying a coupon, changing shipping, etc.)?
    • Does this happen every time, or only under specific conditions?

    Additionally, could you please share your WooCommerce System Status Report?

    You can find it by navigating to WooCommerce → Status, then click Copy for support. Please paste the report using Pastebin and enable the “Burn after read” option before sharing the link here.

    Once we have this information, we’ll be happy to investigate this further.

    Looking forward to your reply!

    Thread Starter cutu234

    (@cutu234)

    Thank you very much for the prompt reply. You got it exactly right. Here are the steps to reproduce the issue:
    1. Add product to the cart
    2. Go to checkout and fill in all required fields in the checkout form (as guest)
    3. Go back to cart and change the quantity of the product
    4. Go to checkout > address field are filled in automatically, but not name, telephone, email etc.

    Here’s the status report. Please note that I removed inactive plugins from the list. This is a test server with many inactive plugins installed for test purposes:

    https://pastebin.com/LM5QDVXy

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi @cutu234!

    Thank you for providing more details about the issue and for sharing the System Status Report.

    I’ve reviewed the information you shared, and everything appears to be in order. I also followed the exact steps you provided on my test site, but I wasn’t able to reproduce the issue. In my testing, the guest customer’s details, including the name, email address, phone number, and country, remained populated after updating the cart quantity and returning to the checkout page.

    To help us investigate this further, could you please share the URL of the site where you’re experiencing the issue? I’d like to test it directly and see if I can reproduce the behavior on your site.

    Looking forward to your reply.

    Thread Starter cutu234

    (@cutu234)

    Yeah, sure:

    https://demo.my-blog-shop.de/produkt/test/

    Please note, this is an ugly test installation. 🙂

    I tested it in the latest Chrome and Opera in incognito mode. Active theme is Storefront with only Woocommerce activated. WP, theme and Woo are all latest versions.

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi @cutu234!

    Thank you for sharing the staging site URL.

    I tested the site on my end and was able to replicate the issue.

    I can see that you’re currently using the Classic Cart and Classic Checkout. I also tested the same setup on my own test site using the Classic Cart and Classic Checkout, and I was able to reproduce the issue there as well. However, when I switched to the Cart Block and Checkout Block, I was no longer able to replicate the issue.

    Could you please replace the Classic Cart and Classic Checkout with the Cart Block and Checkout Block on your staging site, then test again to see if the issue still occurs?

    I’d like to confirm whether using the block-based Cart and Checkout resolves the issue on your site as well. This will help us determine whether the issue is specific to the classic checkout flow before we investigate it further.

    Please let us know the results.

    Thread Starter cutu234

    (@cutu234)

    Thank you very much. That was a big request, since I NEVER use the block editor—I hate it with a passion. 🙂

    I can confirm that the checkout block works perfectly. I could use a snippet, but it would probably be a good idea to implement this as the default for the Classic Editor. I’m not the only one who isn’t particularly thrilled with Gutenberg. 🙂

    Thanks for checking that out so quickly!

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi @cutu234!

    Thank you for confirming the results, and I appreciate you taking the time to test the Checkout Block.

    I checked this further and found that this is the current default behavior with the Classic Cart and Classic Checkout.

    If you’d like to see this behavior improved for the Classic Cart and Classic Checkout, I’d recommend submitting a feature request to our team here:https://woocommerce.com/feature-requests/woocommerce/. That way, our developers can review the suggestion and consider it for a future release.

    Thank you again for your cooperation and for helping us investigate this!

    Thread Starter cutu234

    (@cutu234)

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi @cutu234

    Thank you for taking the time to submit the feature request. We really appreciate you sharing your feedback with us.

    Feature requests help our development team better understand what improvements are important to users, and they’ll review your suggestion for consideration in a future release.

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

You must be logged in to reply to this topic.