sadmann7 / skateshop

An open source e-commerce skateshop build with everything new in Next.js.
https://skateshop.sadmn.com
MIT License
5.07k stars 730 forks source link

Adding Shipping Calculation based on Stripe Address Form #114

Open JDLanctot opened 5 months ago

JDLanctot commented 5 months ago

A few notes about this PR:

  1. The updated shipping price and total are reflected in the UI but not the stripe PaymentIntent. This is still a TODO.
  2. A new file called checkout-content.tsx was created to have some allow for "use client" for the majority of the checkout components. This probably should eventually become a shell, but as there was already a checkout-shell deeper in the checkout structure I didn't want to create a second shell to confuse things.
  3. The next.config.js had to be updated because without the changes, there is some sort of hexoid error (which likely has to do with the dependencies introduced with EasyPost).
  4. Getting shipping rates is handled with a server action when the switch for confirming the address is toggled, which makes it so that the Pay button is no longer disabled and shipping rates are rendered. Changing the shipping address resets the confirm switch so that shipping must be recalculated on the next switch toggle.
  5. Currently using the lowest shipping rate, but this can be changed if required.
vercel[bot] commented 5 months ago

Someone is attempting to deploy a commit to a Personal Account owned by @sadmann7 on Vercel.

@sadmann7 first needs to authorize it.