Building online store cart and checkout

Hello!

I’m also not familiar with Swell, but I think you skipped a step. You first need to create a cart, then add items to it, then it properly generates a checkout_url for you once the required fields have been set for the “cart” type.


This is a useful area of the docs to browse: Backend API: The cart model | Swell

You need to handle users adding items to cart and filling out shipping & billing details client-side. And when the user clicks checkout, that’s when you call the API to send the completed cart model so you get a proper checkout_url response.

Here’s an example I quickly put together that stores all items added to cart to a page state variable if you get confused with states: Plasmic

Hope this helps!

1 Like