chec / commercejs-nextjs-demo-store

Commerce demo store built for the Jamstack. Built with Commerce.js, Next.js, and can be one-click deployed to Netlify. Includes product catalog, customer login, categories, variants, cart, checkout, payments (Stripe) order confirmation, and printable receipts.
https://commercejs-demo-store.netlify.app/
BSD 3-Clause "New" or "Revised" License
1.07k stars 206 forks source link

Provide better population of shipping country options. #123

Closed ThornM9 closed 4 years ago

ThornM9 commented 4 years ago

I'm submitting this PR as part of Hacktoberfest. This PR is related to issue #116. I have edited the checkout state object to include the checkout token, which is saved to state once it's generated. This checkout token is used to call commerce.services.localeListShippingCountries as per the documentation in https://commercejs.com/docs/sdk/checkout#list-available-shipping-countries. I've also ensured that getAllCountries is called after the token is generated.

I've tested this locally, but there were some 404 errors from the Chec API that seem to be unrelated to my code changes that I had difficulty debugging.

ThornM9 commented 4 years ago

Sorry this PR included more commits that I intended because I was committing to master and am basing it to the bug/bug-fix branch, I'll close this PR, fix this issue and reopen a new one and link that to this PR.