Repository navigation
feat: pickup locations (spec pickup-locations) - #2924
Merged
Merged
Conversation
Implements slice 1 of spec pickup-locations. - locations.accepts_pickup, folded into the baseline, with an acceptsPickup() scope and Location::defaultPickup(). - FulfilmentMethod gains isAvailable(). Pickup is available only while a location accepts pickup, and supporting() leaves unavailable methods out, so carts, line validation and the resolver stop offering pickup. - The resolver and changeMethod() skip a location that stopped accepting pickup and fall back to defaultPickup(); setPickupLocation() and changeMethod() reject one that doesn't accept it. - A collection-only item can't be added while no method it allows is available, and order creation rejects a line set to pickup with nowhere to collect it. - New installs, demo data, the v1 upgrade step and the alpha upgrade guide mark the default location as accepting pickup. Amp-Thread-ID: https://ampcode.com/threads/T-93f5bf5e-cf09-4d8c-b762-f078aeff3876 Co-authored-by: Amp <amp@ampcode.com>
Implements slice 2 of spec pickup-locations. The table-rate pickup method offers no option once its location stops accepting pickup, falls back to Location::defaultPickup() when it has none, and its panel and Filament location selects list and accept only locations that accept pickup. Amp-Thread-ID: https://ampcode.com/threads/T-93f5bf5e-cf09-4d8c-b762-f078aeff3876 Co-authored-by: Amp <amp@ampcode.com>
… methods Implements slice 3 of spec pickup-locations. - The panel and Filament location forms get a "Customers can collect from here" toggle, and both location indexes show a Pickup badge. - The change-to-pickup location selects on the panel and Filament fulfilment cards list only locations that accept pickup, starting at the order's pickup location while it still accepts pickup, else Location::defaultPickup(). - The variant forms leave an unavailable method out of the checklist. A variant that still names one keeps it ticked with a warning, and an unrestricted variant stays unrestricted, so pickup comes back once a location accepts it. - Translations in all 16 locales; the carts reference shows how to list pickup locations, and the upgrade guide names isAvailable(). - The spec is marked implemented and moved to specs/completed, with its open questions settled on the proposed behaviour. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-93f5bf5e-cf09-4d8c-b762-f078aeff3876
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Any location could be a pickup point, and nothing recorded which ones have a counter. Pickup customers fell back to the default location even when it was a warehouse. A store with no counter anywhere could still offer pickup and make items collection-only. This implements spec pickup-locations, slices 1 to 3, as one commit per slice.
What changed
locations.accepts_pickup(defaultfalse),Location::acceptsPickup()andLocation::defaultPickup().FulfilmentMethodgainsisAvailable(), and pickup is available only while a location accepts it, sosupporting(), carts, line validation and the resolver stop offering it. The resolver andchangeMethod()skip a location that stopped accepting pickup.setPickupLocation()andchangeMethod()reject one that doesn't accept it. A collection-only item can't be added while pickup is unavailable. New installs, demo data, the v1 upgrade step and the alpha upgrade guide mark the default location as accepting pickup.specs/completed.Tradeoffs
Pickup::supports(). It lives in a newisAvailable()on the contract instead, whichsupporting()also requires. That lets the variant forms tell "unavailable right now" from "never fits this variant", so a collection-only variant keeps Pickup ticked with a warning instead of showing an empty checklist. It's a contract change: custom fulfilment methods addisAvailable(), as the alpha and v1 upgrade guides now say.Verification