Hacker News new | ask | show | jobs
by keslert 2009 days ago
I have a site (https://familytreechart.com) with a similar integration with Shopify but one thing I've never figured out is how to send someone to Shopify's checkout page with a preconfigured cart. It looks like you are managing the cart on the nextjs side. How are you generating the checkout page with the right items? I've resorted to creating a DraftOrder, but those don't allow for discount codes so I also had to handle that on my end when creating the draft order. Email in profile if easier.
1 comments

There are cart permalinks [1] that you could use but depending on how much you want to pre-populate I recommend using the JS Buy SDK. I found it the other day and set up a custom free gift with discount code for a Shopify Plus client. The discount code uses the BOGO but the custom functionality checks the conditions and adds the product(s) to the checkout if it is not already there then applies the discount (the client wanted to use the discount code to add the free gift instead of a permalink).

You can add to cart, then add the discount, then redirect to checkout all within one link (working on an app to help merchants generate them).. I believe that is the proper flow but I cannot remember off the top of my head I just know that is all currently possible with a single link.

That said, I have been made aware that the checkout experience will be changing next year. I'm not sure what that entails yet just that it is coming.

Also, having worked with Shopify rather heavily since August, I love it.

[1] https://community.shopify.com/c/Shopify-Design/Cart-Use-perm...

Thanks for the suggestions! I hadn't seen the cart permalinks before, but that might work well for us.