Shopping Cart Logic

I ran into the same situation. Another option would be to check out e.g. Vue Storefront https://www.vuestorefront.io/, which is a nice storefront system with goodies like offline mode. ERPNext could be integrated with it as a backend system. I found an ERPNext module for it, but it seems incomplete: GitHub - vijaywm/vsf-erpnext: vuestorefront api for Erpnext

2 Likes

I would think it be far better to fix the last few little things in erpnext cart so we’re all using vanilla option and progressing that instead of spreading thin.

2 Likes

In an ideal world. But this issue has been around for a long time.
And me personally can’t spend time on learning Frappee to build a nicer shopping cart experience at the moment.

I wonder how much of a bounty it would require

In my opinion, it is better to separate the ERP from the web shop. Intensive store must be very well optimized for SEO and must scale well (in high seasons you need a lot of computing power).

A better solution will be to create a synchronizer with the already existing platforms of the Internet sales.

2 Likes

This is why I suggested to take a look at Vue Storefront. They are building a backend agnostic storefront on the Vue Storefront Next branch, you can check it out here: https://docs-next.vuestorefront.io/

This way ERPNext could leverage all the development that goes into the storefront, and our job would be “only” to provide a backend connector. This is still non-trivial, but much simpler than building a similar experience from scratch.

2 Likes

that looks interesting.

the vuestorefront.io has been a good tip to look at.

dredging this topic up again… we NEED guest checkout on the stock ERPNext shopping cart…

2 Likes

I would love to see this options as well. It would streamline the shopping experience. Its a lot of hustle for users to sign up to just use a shopping cart.

update: I think Social Login kinda solves this problem. Users can easily sign up using Facebook or Google not wasting time. Its also beneficial for us since we can quickly collect the user information.

I’ve been studying this over the past two weeks.

Currently, the cart requires login because it stores you “cart” in a Quotation. The quotation is saved to the database and therefore requires a Party/Customer to be set. This is a great feature because a user can logout and come back to where they left off…that is if they are registered.

I’ve run some tests and it is possible to have a Quotation calculate Discounts and Taxes without saving it to the database.

So I’ve been going back and forth on the idea of creating a “guest cart” app that works along side Webshop or giving up and using a 3rd party platform. Though I want to avoid a solution that requires “syncing”. Vue Storefront claims no syncing, seems to be more like a read-only version of your data, but I have not read if I can authenticate via Frappe.

The Guest Cart would basically have the same API as Webshop, but the whitelisted methods would have “allow_guest” set to true and have simpler features. Also, store the cart in LocalStore on the browser for non-logged in users. Though adding a “Guest Cart” doctype accessed via a guest session id store in LocalStore would allow the contents to be used in the background and to re-market abandoned carts. One downside is that the abandoned carts would build-up overtime, as opposed to just keeping the data on the user’s browser.

You would then need only a few endpoints. Here’s a rough idea.

  • /calculate_cart
    • Pass the cart contents
    • Create a Quotation (guest_quot) object filled with cart items and eventually address.
    • Returns the updated values based on guest_quot.run_method(“set_price_list_and_item_details”) and guest_quot.run_method(“calculate_taxes_and_totals”)
    • Store the results in LocalStorage or call on demand when viewing the cart page.
  • /place_order
    • Post your custom checkout form page’s data (items, billing/shipping addresses, shipping method, payment method transaction ID (using something like Stripe/Braintree on the same page)
    • Do any pre-validation you deem necessary on the incoming data
    • Create the Customer record
    • Create the Sales Order (I’m not sure it’s necessary to get Quotation involved at this point)

Reason why I’ve not gone ahead is the close coupling Webshop has with its JS and HTML. All the functions basically check if you’re a guest and redirect you. Also, I do not like how Webshop uses an JS API call on the frontend to grab products, that’s way too slow. I thought the site was broken and then all of a sudden the products show up…

I’m not completely saying no, but I’m also going to be taking a closer look at Vue Storefront this week. However, it seems like making it work with ERPNext is close to just writing a headless cart API anyways. I’ve been studying MedusJS too and wondering, well, why not just add the same API endpoints that Medusa has to Frappe? It does mean that it would require more technical skills to implement as apposed to just dropping in Webshop having product pages without any coding.

6 Likes

If you go for VueStorefront integration I’ll try to help.

2 Likes

Reading up on it now. Odoo uses it, so it should be fairly straightforward getting Frappe integrated.

2 Likes

Yep, but that’s not that easy. At least for me.

1 Like

@ccraig I did something to berio-topo.com on the past!

We created a dummy lead, that was using some kind of a cookie, to identify the not authenticated user, with that we create a quote on the ERP, but each quote is tight to that “cookie”, so when the user logs in, the quote is moved for the right lead or the right customer.

4 Likes

I saw the Presta Shop integration was passing cookies.

What stack is berio-topo using? My Wappalyzer app just shows ERPNext and Frappe. Does that mean you’re using Webshop?

1 Like

@ccraig yes, we are using the webshop!

We did a lot of fixes and improvements, but definitivelly, yes is the pure webshop!

3 Likes

I also thought Vue Storefront and MedusaJS were good candidates to enhance / augment the eCommerce offering in Frappe.

I’ve declined an opportunity to submit a proposal / quote recently because Webshop is “untested” and just too new, especially for a very large collection of items with various dimensions such as colour, and packaging options.

What concerns me most is the SEO capabilities for such a large collection of items and how that would be achieved / optimised?

So, I’m following this topic with great interest…

4 Likes

Hi Craig,

I’ve been quite on the same track.

Do you wanna have a casual call to toss some design ideas around?

Cheers!

4 Likes

Yes, I’d love a chat!

My latest update is that I’m playing with Vendure (headless ecommerce) using this SvelteKit based store front stater.

It’s been around longer than MedusaJS and seems a bit more complete. However, next week on the 9th, MedusaJS said they are announcing version 2.0.

I also want to include part of a message I sent in the Telegram Webshop group:

There is merit to having two separate backends. Some benefits are:

  1. If ERPNext goes down (bug/update breaks it/data corruption/server outage/hacker) your eCommerce site is still up and vice versa.
  2. Heavy traffic load on your eCommerce won’t affect your ERPNext.
  3. You may want your eCommerce hosted on the edge or geographical locations for performance and load balancing.

So I may continue down the Vendure path in order to I have a separation of concerns.

6 Likes