Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shopping Cart #116

Open
blaggacao opened this issue Mar 21, 2024 · 8 comments
Open

Shopping Cart #116

blaggacao opened this issue Mar 21, 2024 · 8 comments

Comments

@blaggacao
Copy link
Contributor

I wonder a bit what the way forward would be for Frappe deployments on the shopping cart implementation.

As I currently (2 days into exploring builder) understand it, it's relatively easy to efficiently query all sorts of data from the backend.

Beyond that, the frappe/webshop app implents a B2B store component for logged in users.

What seems to be missing is an anonymous ("lightweight") checkout experience, that works only with the cuatomer's email or phone number + some memoized browers-local key/coockie to authorize recovery of any ongoing or past transaction, but without formal registration.

@batonac
Copy link

batonac commented Mar 22, 2024

I wonder if Frappe and Builder could be extended to enable apps to provide builder components that could help close this gap. I'm thinking the frappe/payments app could provide a payment form component, frappe/webshop a mini cart, main cart, and checkout components, etc.

@blaggacao
Copy link
Contributor Author

Yes, indeed, the only limitation is that webshop doesn't allow "anonymous" (really: lightweight) checkouts, with say only an email or mobile phone.

That's a transaction killer in most b2c cases.

@blaggacao
Copy link
Contributor Author

I wonder if one could "simply import" this webshop's js library into a builder page: https://github.com/frappe/webshop/tree/develop/webshop%2Fpublic%2Fjs , then write some bindings with the existing builder's scripting capabilities and have a working cart implementation 🤔

There are a couple of thoughts that I want to put down here:

  • would be nice to only import the subcomponents ome wishes (out of cart, wishlist, product_ui, etc) in order to minify loaded assets and keep lighthouse scores high
  • I've seen some localstore stuff around in the code, but we'd need to make sure the store is fully offline / local (with occasional, async syncing of the in-flight cart -> Quotation) - except for the actual order processing
  • need to ensure it works standalone (without much the other js code in webshop) -- how to handle session and fingerprinting?
  • establish a "lightweight", implicit registration based on user-provided (non-authenticated) email or phone + browser fingerprint (curious thought: use fingerprint as password? Reset upon "proper" registration, later?)
  • make all calculation (including tax, and shipping) frontend as much as possible (or async?)

To design the checkout freely with builder:

  • in addition to data key, add localstore to retrieve state from the cart app
  • popup/slider can just be implemented like the navbar in frappe.io (no need to implement any special support; other than how-to)

Checkout:

Server Session: either login session or dummy session (email field in checkout form - fingerprint) *

  • Use (already asyncly created/updated) Quotation as payment reference
  • implement embedded payment widget (operating on Email/phone + Quotation Ref [+ more user session data])

On success

  • Client flow: pass digitally signed payload to server for processing
  • IPN: Server-to-server process - (notify cart via socket.io, without reload? Or uses server and client flow in parallel where client flow updates the cart ui for the user? - both scenarios are possible e.g. with PayZen)

* because even a debounced email input field is unstable (think: user correction), we should create a temporary user based on the (within the time horizon) more stable fingerprint. We can create those users as "throwaway users" garbage collected after say 30 days, bit which can be transformed into "real users" after signup. Of the email

If the email / phone ends up matching a real user, the checkout should show a password filed + a login button to establish an authenticated session, instead.

So far so good, brainstorming to be continued.

@federicocalvo
Copy link

Hi @blaggacao , there are so many threads with these interesting loose discussions (https://discuss.frappe.io/t/shopping-cart-logic/43263/20) , with something as important as this, that as I said in the webshop telegram group, it's unbelievable that they don't assign someone as repository leader.

I saw great input from you, it would be great to have the others involved in this issue or in a single thread.

@blaggacao
Copy link
Contributor Author

I'm currently refactoring frappe/payments#53 - without a repository leader. :-)

But my idea is to prepare the groundwork for a checkout feature.

@federicocalvo
Copy link

@blaggacao awesome work, like others you have too, but we need the repository leader to accept your PRs 😅

@blaggacao
Copy link
Contributor Author

Next round: frappe/frappe#25820 -- step by step, we may be getting there. 🚀

@federicocalvo
Copy link

@blaggacao awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants