Repository navigation
Add three one-click reorder options to order history - #1282
Open
claire-carew wants to merge 1 commit into
Open
claire-carew wants to merge 1 commit into
claire-carew wants to merge 1 commit into
Conversation
Assisted-by: Replit
Contributor
|
@claire-carew is attempting to deploy a commit to the Saleor Commerce Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
make it red instead of blue |
This branch has not been deployed
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.
What this adds
A "Buy again" action on the account order-history page that adds a past order's still-available lines to the current cart. Three presentations are included so they can be compared, switchable with
?view=:?view=quick, default): one button per order that re-adds every available line at the original quantity.?view=receipt): the order expands into its line items, with a single "Add all to cart" action.?view=choose): per-line checkboxes and quantities, then add only the selected lines.Lines whose variant is deleted, unpublished in the channel, or out of stock are skipped, and the UI reports what was skipped.
How it works
src/graphql/extensions/BuyAgain.graphql:BuyAgainOrderfragment (spread intoCurrentUserOrdersPaginated) and aBuyAgainAddcheckout-lines mutation, registered as a session mutate operation insrc/config/data-extensions.ts.src/lib/custom/buy-again.ts: pure logic that turns order lines into checkout lines, filtering unavailable variants and merging duplicates.src/app/buy-again/actions.ts: server action that resolves or creates the cart and calls the mutation through@/lib/saleor.src/ui/components/account/buy-again.tsx: client component for the three views;order-row.tsxgains agroupedprop; the orders page renders the view switcher.messages/en.jsonstrings underaccount.buyAgain;data-layer.lock.mdregenerated.Validation
pnpm run verifypassed: 129 test files, 795 tests, lint 0 errors. New unit tests cover the line-mapping logic and the server action.pnpm run buildwas not run.Notes for review
mainand has not been rebased.~ written by ⠕ Replit