Fix fulfillment type determination logic#470
Fix fulfillment type determination logic#470Octobr26 wants to merge 4 commits intowoocommerce:trunkfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors how WooCommerce Square determines and serializes order fulfillment and shipping data so that Local Pickup (local_pickup) orders sync to Square as pickup fulfillments instead of shipment fulfillments (addressing #465).
Changes:
- Determine fulfillment type as
SHIPMENTonly when a non-local_pickupshipping method is present. - Exclude
local_pickupmethods from Square “shipping” line items and shipping service charges. - Centralize pickup detection in a shared
is_local_pickup_method()helper.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
faisal-alvi
left a comment
There was a problem hiding this comment.
@Octobr26 Thanks for the fix. I have a concern: Local pickup is fully removed from both line items and service charges. When a store charges for pickup (e.g. $2.99), that amount is no longer sent to Square, so WooCommerce and Square totals can mismatch.
There’s also some Copilot-reported feedback on this PR; it would be good to look into that, too, when you have a chance. Thanks again!
All Submissions:
Changes proposed in this Pull Request:
This PR fixes Local Pickup orders being mapped to shipping semantics during Square order sync.
Changes:
SHIPMENTonly when a non-local_pickupshipping method is present.local_pickupmethods are excluded from Square shipping line items.local_pickupmethods are excluded from Square shipping service charges.is_local_pickup_method) so pickup detection logic is centralized and reused across all relevant paths.This ensures Local Pickup orders are sent to Square as pickup orders, not shipment orders.
This also addresses the Local Pickup sync bug tracked in #465.
Closes #465 .
Steps to test the changes in this Pull Request:
method_id: local_pickup) with one or more line items.PICKUP(notSHIPMENT), and verify Local Pickup is not sent as a shipping line item/service charge.SHIPMENTand shipping data is present as expected.Changelog entry