How a WooCommerce checkout bug caused billing addresses to revert—and how it was fixed

When customers enter a billing address during checkout, they expect that information to be preserved for that specific order. But in some WooCommerce setups, unexpected interactions between themes, payment gateways, and custom scripts can override user input.

In this case, billing addresses were being silently replaced with shipping or saved account data during checkout. The issue required deep debugging across WooCommerce, a payment gateway, and a theme-level implementation.

Issue Background

A WooCommerce store began receiving reports that billing addresses were not saving correctly:

  • Customers entered a different billing address at checkout
  • After placing the order, the billing address reverted
  • The saved account address or shipping address replaced the entered data
  • The issue appeared inconsistent at first

The expected behavior was that billing data entered at checkout should apply only to that order and should not be overridden by saved account data.

Diagnosis

The issue involved multiple interacting components, including WooCommerce, the Braintree payment gateway, the Divi theme, and custom checkout logic.

  • Selecting Braintree triggered an AJAX refresh that re-rendered checkout fields
  • Customer-entered billing data was temporarily lost during the refresh
  • Custom billing/shipping sync logic repopulated billing fields incorrectly
  • Divi created duplicate hidden billing fields with stale values
  • A server-side fallback incorrectly overwrote valid billing input

Together, these factors caused valid billing addresses to be replaced before the order was finalized.

Resolution Steps

1. Reproduce the issue

Tested checkout using Braintree and confirmed the issue occurred consistently during payment selection.

2. Fix frontend duplication

Resolved Divi-related duplication of billing fields to ensure only current user input is retained.

3. Adjust sync logic

Refined billing and shipping synchronization to prevent overwriting after AJAX refresh events.

4. Preserve data through AJAX

Ensured billing data persists correctly through WooCommerce checkout refresh cycles.

5. Remove faulty fallback

Eliminated an overly aggressive server-side safeguard that incorrectly reverted valid billing data.

6. Add test coverage

Implemented automated tests for edge cases including partial address differences and payment method switching.

7. Validate across scenarios

Tested logged-in users, guest checkout, and multiple payment methods to confirm consistent behavior.

Final Outcome

  • Billing addresses entered at checkout are preserved correctly
  • No unintended overwriting occurs
  • Checkout works consistently across payment methods
  • Saved account data no longer interferes with order-specific input

If your WooCommerce checkout isn’t behaving as expected, Freshy can help identify and fix complex issues like this.
Contact Freshy