Skip to content

Show correct heading for billing address when Local Pickup is selected#58220

Merged
senadir merged 5 commits intowoocommerce:trunkfrom
BurakParsAydin:fix/58213
Mar 7, 2026
Merged

Show correct heading for billing address when Local Pickup is selected#58220
senadir merged 5 commits intowoocommerce:trunkfrom
BurakParsAydin:fix/58213

Conversation

@BurakParsAydin
Copy link
Copy Markdown
Contributor

@BurakParsAydin BurakParsAydin commented May 22, 2025

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #58213 .

(For Bug Fixes) Bug introduced in PR # .

Screenshots or screen recordings:

Screenshot from 2025-05-23 00-33-43

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

How to test the changes in this Pull Request

  1. Enable Local Pickup

    • Go to WooCommerce > Settings > Shipping.
    • Create a Shipping Zone if one doesn’t exist.
    • Add a Local Pickup method to the zone.
  2. Enable "Force shipping to the customer billing address"

    • Go to WooCommerce > Settings > Shipping > Shipping destination.
    • Enable the checkbox: "Force shipping to the customer billing address".
    • Save the settings.
  3. Navigate to Checkout

    • Add any product to the cart.
  4. Verify heading behavior

    • Select a shipping method (e.g., Ship):
      • The address heading should read: "Billing and shipping address".
    • Switch to Local Pickup:
      • The heading should update to: "Billing address" only.

This ensures the heading accurately reflects the actual checkout scenario.

Testing that has already taken place:

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Changelog Entry Comment

Comment

Fix - Show 'Billing address' instead of 'Billing and shipping address' when Local Pickup is selected and shipping is forced to the billing address.

@github-actions github-actions Bot added plugin: woocommerce Issues related to the WooCommerce Core plugin. type: community contribution labels May 22, 2025
@BurakParsAydin BurakParsAydin marked this pull request as ready for review May 22, 2025 21:40
@jorgeatorres jorgeatorres marked this pull request as draft January 14, 2026 15:22
@jorgeatorres jorgeatorres marked this pull request as ready for review January 14, 2026 15:22
@jorgeatorres jorgeatorres requested a review from a team as a code owner January 14, 2026 15:22
@jorgeatorres jorgeatorres requested review from straku and removed request for a team January 14, 2026 15:22
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 00bcfd6f-dcaf-4ef5-b6d7-5255c763fe50

📥 Commits

Reviewing files that changed from the base of the PR and between bf29941 and 58a274c.

📒 Files selected for processing (1)
  • plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx

📝 Walkthrough

Walkthrough

Adjusts checkout billing address block text when Local Pickup is selected and billing is forced: the UI shows "Billing address" instead of "Billing and shipping address" by treating Local Pickup as exempt from forced-billing wording.

Changes

Cohort / File(s) Summary
Changelog Entry
plugins/woocommerce/changelog/fix-58213
Added changelog entry documenting the UI text change for Local Pickup with forced billing address.
Frontend Component
plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx
Imported useShippingData, derived hasSelectedLocalPickup from shipping rates, and passed it into title/description utilities. Rendering gating unchanged.
Utility Functions
plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/utils.tsx
Added isLocalPickup parameter to getBillingAddresssBlockTitle and getBillingAddresssBlockDescription; conditional logic now applies forced-billing text only when isLocalPickup is false, otherwise preserves standard title/description mappings.

Sequence Diagram(s)

sequenceDiagram
  participant Component as Checkout Billing Component
  participant Hook as useShippingData Hook
  participant Utils as Title/Description Utils
  participant UI as Rendered UI

  Component->>Hook: request shipping data
  Hook-->>Component: returns shipping rates (includes pickup selection)
  Component->>Utils: get title/description (forcedBilling, hasSelectedLocalPickup)
  Utils-->>Component: computed title/description
  Component->>UI: render billing block with title/description
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately summarizes the main change: correcting the heading text when Local Pickup is selected with forced billing address.
Description check ✅ Passed The PR description is directly related to the changeset, providing clear reproduction steps, expected behavior, and screenshots demonstrating the fix.
Linked Issues check ✅ Passed The PR successfully addresses all requirements from issue #58213: showing 'Billing address' instead of 'Billing and shipping address' when Local Pickup is selected with forced billing address setting enabled.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the identified issue; the PR modifies only the billing address heading logic and its utility functions without introducing unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 14, 2026

Testing Guidelines

Hi @woocommerce/rubik,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

@woocommercebot woocommercebot requested review from a team, gigitux and prettyboymp and removed request for a team January 14, 2026 15:23
@straku straku requested review from opr and removed request for straku February 3, 2026 11:16
@opr
Copy link
Copy Markdown
Contributor

opr commented Feb 4, 2026

Hi, I'll be AFK until 20th February, and due to capacity constraints it's not likely this will be reviewed before then, so I appreciate your patience and I will review when I get back.

@opr opr removed request for gigitux and prettyboymp February 4, 2026 16:28
@senadir senadir added this to the 10.6.0 milestone Mar 6, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/utils.tsx (2)

24-40: ⚠️ Potential issue | 🟠 Major

Same parameter issue applies here.

This function also requires the new isLocalPickup parameter that isn't passed from edit.tsx. Apply the same fix (make parameter optional with default false or update edit.tsx).

Make parameter optional
 export const getBillingAddresssBlockDescription = (
 	description: string,
 	forcedBillingAddress: boolean,
-	isLocalPickup: boolean
+	isLocalPickup: boolean = false
 ): string => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/utils.tsx`
around lines 24 - 40, The getBillingAddresssBlockDescription function signature
must accept an optional isLocalPickup so callers that haven't been updated (like
edit.tsx) won't break; update the function declaration
(getBillingAddresssBlockDescription) to make isLocalPickup default to false (so
callers can omit it) and ensure the implementation uses that parameter as-is, or
alternatively update edit.tsx to pass the new isLocalPickup boolean from
component state/props whenever calling getBillingAddresssBlockDescription.

11-22: ⚠️ Potential issue | 🟠 Major

Missing third parameter in edit.tsx call site.

The function signature now requires 3 parameters (title/description, forcedBillingAddress, isLocalPickup), but edit.tsx (lines 42–49) calls both functions with only 2 parameters. This breaks backwards compatibility and will cause TypeScript errors or undefined behavior at runtime.

Since the editor context doesn't support local pickup selection, either:

  1. Make isLocalPickup optional with a default of false, or
  2. Update edit.tsx to pass false explicitly

The frontend implementation (lines 55–64) correctly passes the third parameter, showing the expected usage pattern.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/utils.tsx`
around lines 11 - 22, The call site in edit.tsx invokes
getBillingAddresssBlockTitle with only two args causing errors because the
function now requires isLocalPickup; make the third parameter optional with a
default false (e.g., change the signature of getBillingAddresssBlockTitle to
accept isLocalPickup?: boolean = false) so existing two-arg calls in edit.tsx
continue to work, and ensure any other call sites that do know local-pickup pass
the boolean explicitly.
🧹 Nitpick comments (1)
plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx (1)

43-49: Use the existing hasSelectedLocalPickup from the hook instead of re-deriving it.

The useShippingData hook already exports hasSelectedLocalPickup (returned at line 126 of use-shipping-data.ts). This manual computation duplicates existing logic and should be replaced with the hook's property.

♻️ Simplify by using the hook's existing property
-	const { shippingRates } = useShippingData();
-
-	const hasSelectedLocalPickup = shippingRates.some( ( pkg ) =>
-		pkg.shipping_rates.some(
-			( rate ) => rate.method_id === 'pickup_location' && rate.selected
-		)
-	);
+	const { hasSelectedLocalPickup } = useShippingData();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx`
around lines 43 - 49, The code is recomputing hasSelectedLocalPickup by
iterating shippingRates; instead import and use the existing
hasSelectedLocalPickup returned by useShippingData instead of re-deriving
it—remove the manual computation that references shippingRates and replace uses
of the local hasSelectedLocalPickup with the hook-provided
hasSelectedLocalPickup from useShippingData to avoid duplicated logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/utils.tsx`:
- Around line 24-40: The getBillingAddresssBlockDescription function signature
must accept an optional isLocalPickup so callers that haven't been updated (like
edit.tsx) won't break; update the function declaration
(getBillingAddresssBlockDescription) to make isLocalPickup default to false (so
callers can omit it) and ensure the implementation uses that parameter as-is, or
alternatively update edit.tsx to pass the new isLocalPickup boolean from
component state/props whenever calling getBillingAddresssBlockDescription.
- Around line 11-22: The call site in edit.tsx invokes
getBillingAddresssBlockTitle with only two args causing errors because the
function now requires isLocalPickup; make the third parameter optional with a
default false (e.g., change the signature of getBillingAddresssBlockTitle to
accept isLocalPickup?: boolean = false) so existing two-arg calls in edit.tsx
continue to work, and ensure any other call sites that do know local-pickup pass
the boolean explicitly.

---

Nitpick comments:
In
`@plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx`:
- Around line 43-49: The code is recomputing hasSelectedLocalPickup by iterating
shippingRates; instead import and use the existing hasSelectedLocalPickup
returned by useShippingData instead of re-deriving it—remove the manual
computation that references shippingRates and replace uses of the local
hasSelectedLocalPickup with the hook-provided hasSelectedLocalPickup from
useShippingData to avoid duplicated logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 96ff3f85-9338-4c67-9b5c-e37dba380b82

📥 Commits

Reviewing files that changed from the base of the PR and between cdf2cc6 and bf29941.

📒 Files selected for processing (3)
  • plugins/woocommerce/changelog/fix-58213
  • plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx
  • plugins/woocommerce/client/blocks/assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/utils.tsx

Instead of manually checking for 'pickup_location' method_id which
doesn't cover all local pickup methods, use the existing
hasSelectedLocalPickup property from useShippingData hook.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@senadir senadir enabled auto-merge (squash) March 6, 2026 16:14
@senadir senadir merged commit f831491 into woocommerce:trunk Mar 7, 2026
67 of 71 checks passed
@github-actions github-actions Bot added the needs: documentation The issue/PR requires documentation to be added. label Mar 7, 2026
github-actions Bot pushed a commit that referenced this pull request Mar 7, 2026
#58220)

* Show correct heading for billing address when Local Pickup is selected

* Refactor: Use shippingRates to reliably detect Local Pickup selection

* Add the changelog file

* Use hasSelectedLocalPickup from useShippingData directly

Instead of manually checking for 'pickup_location' method_id which
doesn't cover all local pickup methods, use the existing
hasSelectedLocalPickup property from useShippingData hook.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@woocommercebot woocommercebot added the cherry pick failed Used when an automated cherry pick PR (from a CFE or PRR) fails to be generated. label Mar 7, 2026
@senadir senadir modified the milestones: 10.6.0, 10.7.0 Mar 7, 2026
@woocommerce woocommerce deleted a comment from woocommercebot Mar 7, 2026
samnajian pushed a commit that referenced this pull request Mar 11, 2026
#58220)

* Show correct heading for billing address when Local Pickup is selected

* Refactor: Use shippingRates to reliably detect Local Pickup selection

* Add the changelog file

* Use hasSelectedLocalPickup from useShippingData directly

Instead of manually checking for 'pickup_location' method_id which
doesn't cover all local pickup methods, use the existing
hasSelectedLocalPickup property from useShippingData hook.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
jamesckemp pushed a commit that referenced this pull request Mar 11, 2026
#58220)

* Show correct heading for billing address when Local Pickup is selected

* Refactor: Use shippingRates to reliably detect Local Pickup selection

* Add the changelog file

* Use hasSelectedLocalPickup from useShippingData directly

Instead of manually checking for 'pickup_location' method_id which
doesn't cover all local pickup methods, use the existing
hasSelectedLocalPickup property from useShippingData hook.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry pick failed Used when an automated cherry pick PR (from a CFE or PRR) fails to be generated. needs: documentation The issue/PR requires documentation to be added. plugin: woocommerce Issues related to the WooCommerce Core plugin. type: community contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block Checkout Heading

4 participants