Repository navigation
Conversation
Contributor
|
Thanks for this. It now conflicts with main in CheckoutSidebarIsland.tsx after #132 landed, could you rebase onto main? I'll merge it once CI is green. |
A code could only be entered on /cart, so a shopper who went from the cart drawer straight to checkout never saw a coupon box. The cart page and the checkout sidebar now share one CouponBox island that calls the existing cart/coupon and cart/coupon/remove routes and refreshes the totals. The drawer is unchanged. CheckoutSidebar takes couponEntry (default true). The starter turns it off while its embedded Stripe Elements form is on the page: that form sets up the payment before Pay, so a code applied afterwards would show a discount that isn't charged. Hosted and on-page checkouts fix the amount on Pay and keep the box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moset15
force-pushed
the
feat/coupon-box-at-checkout
branch
from
December 5, 2026 22:53
16b595a to
88e28ba
Compare
Contributor
Author
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 and why
A coupon code can only be entered on
/cart. The checkout order summary (CheckoutSidebarIsland) has no coupon box, so a shopper who goes from the cart drawer straight to checkout never sees one. A code applied on/cartdoes carry through.Part of the roadmap in #108.
Behaviour
/cart: looks and works the same. It now uses the same component; the markup and class names are unchanged.CheckoutSidebartakes acouponEntryprop (defaulttrue). The starter turns it off while its embedded Stripe Elements form is on the page, because that form creates the PaymentIntent at "Continue to payment": a code applied after that would show a discount that isn't charged. Shoppers there still enter codes on/cart.HostedCheckoutForm(Stripe Checkout, Paystack and other providers) price the cart when Pay is pressed, so they keep the box.Changes
astro/islands/CouponBox.tsx: the applied codes with a Remove button each, a code field and Apply. It calls the existingPOST cart/couponandDELETE cart/coupon/remove?code=, hands the recalculated cart back to its host, and sends a silentdashcommerce:cart-updatedso other cart views refresh without opening the drawer.CheckoutSidebarIsland.tsx: renders it, with thecouponEntryprop; one CSS line for spacing.CartPageIsland.tsx: the inline coupon block replaced byCouponBox.CheckoutSidebar.astro: passescouponEntrythrough.checkout.astro:couponEntry={!useStripeElements}. Starter README: the/checkoutrow mentions the box.No route changes.
Tests
packages/core/test/coupon-box.test.tsx, rendering withreact-dom/server:cart/couponroute:save10is applied to a cart, and the box rendered from the cart the route returns showsSAVE10, its discount and a labelled Remove button;The tests fail without the change (with only the new component kept, the three wiring tests fail). Full suite: core 372 (364 before), paystack 105, lite 144, registry-setup 5, all passing.
tsc --noEmitpasses for core,astro checkfor the starter, Biome is clean on the new and changed lines;bun.lockis unchanged.Review points
/cartland.main; they're left as they are.Merge order with the shipping-options and tax rows PRs: all three edit
CheckoutSidebarIsland.tsxon neighbouring lines. Each merges cleanly on its own; whichever goes in first, I'll rebase the others straight away.