Skip to content

Customer billing-info element renders empty card when get_billing_address() returns no fields #1116

@superdav42

Description

@superdav42

Summary

$customer->get_billing_address() returns an empty Billing_Address value object for some customer rows in the database, even when the customer was created via a flow that should have captured an address (signup with a non-free product, etc.). The empty value flows through to the customer-panel billing-info element and renders as a blank card with no clear next action.

This was observed for customer id 2 (sthscah) on the local dev environment while debugging the template-switching flow. We have not confirmed whether this is:

  1. A historical-data artefact (the customer pre-dates the schema field that stores the address), in which case the fix is purely UI — render a friendly "Please add your billing address" prompt with a link to the edit form.
  2. A genuine save-side bug where a checkout flow fails to persist the address, in which case the fix is on the gateway/checkout side.
  3. An import path that didn't carry the address forward (e.g. WooCommerce -> Ultimate Multisite migration).

Why a separate issue

#1113 was scoped to template-switching UX, light-ajax fixes, Stripe gateway fixes, and the settings-"false"-string fix. The billing-address rendering is unrelated and non-blocking — putting it in #1113 would have made the review needlessly broader.

Files to inspect

  • inc/objects/class-billing-address.php — the value object, particularly is_empty() / is_valid() / to_array().
  • inc/models/class-customer.phpget_billing_address() accessor.
  • inc/ui/class-billing-info-element.php — renderer used on the customer panel.
  • inc/gateways/class-base-gateway.php and Stripe/PayPal subclasses — the save-time path that should be writing the address.

Reproduction

  1. Log in as customer sthscah (user id 4) in the dev environment.
  2. Visit the customer-panel "billing info" page.
  3. Observe the address card renders with no city/postcode/country lines and no "edit" call-to-action — just empty fields.

Suggested investigation

  1. Inspect the database row directly: SELECT * FROM wp_wu_customers WHERE id = 2; and look at whether the billing fields are NULL, empty strings, or populated.
  2. If populated: bug is in the value-object / renderer pipeline.
  3. If empty: trace back to the customer's signup payment record and check the gateway's process_signup / customer-update code path.
  4. Either way, add a defensive empty-state UI in class-billing-info-element.php so the customer is prompted to fill in their address rather than seeing a confusing blank card.

Severity

Low — display defect, not a billing/charging defect. The customer can still complete a checkout because gateways collect the address fresh at payment time.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingorigin:workerAuto-created by pulse labelless backfill (t2112)priority:mediumMedium severity — moderate quality issuestatus:in-reviewPR open, awaiting review/merge

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions