Grav for e-Commerce?

Would grav work as a CMS for an e-commerce site? I’ve been looking around online and can’t seem to find any info or sites that use grav for e-Commerce. Came here since this seems to be where a bulk amount of grav users online. I began searching for a platform to launch the store on and found Reaction Commerce, an open source e-commerce solution. Not quite sure how to pair Grav and Reaction Commerce together? Can they even be used together? I want to build a scale-able e-commerce shop with a decent blog (articles, videos, etc.). Am I trying to start with the wrong CMS/platform for what I’m looking for? Thanks for reading! If you need more info to better answer anything let me know :slightly_smiling_face:

1 Like

There’s a dedicated plugin for eCommerce: GravCart. If you don’t mind (with asynchronous chat like a forum, you’re left without much choice), I’ll quote an answer given to a new Grav user who was in the same situation recently:

eCommerce and reservation-software, in my opinion, is something that should always be considered in terms of scope: If the site is a medium-sized provider of accommodations or seller of goods, a third-party service should be used. That is, a service in which they can administer what they provide outside of the management of the website itself. Thus regardless of how the service integrates, it should be a separate part of the site.

There are two variants to be aware of: Those who provide access to the goods for sale through an API, or those who provide a full front-end. Personally, at this point in time, I would greatly prefer the former because only the public information is treated by the site - which is far more secure than handling administration in the same place. However, eCommerce has not progressed as fast in this direction, and most of the large providers (Magento, ZenCart, Shopify, WooCommerce, PrestaShop, SquareSpace, Wix) lack a comprehensive decoupling between the storefront and administration.

That said, some services stand out as more modern in this regard: Moltin, MarketCloud, and OpenCart. But this approach, targeted at medium-to-large eCommerce sites is not perhaps apt for smaller businesses. These smaller sites basically need simple product handling and easy checkout, where direct integration with the site itself is more admissible.

Grav has such an integration through GravCart (https://gravcart.com/), but other integrations such as Ecwid or SendOwl should work equally well. To reiterate the points on eCommerce: Use a simple, directly integrated service for smaller sites; allow for partial integration (storefront on the same site, but with separate administration) for medium-sized sites (eg., Shopify, Prestashop); invest in an entirely decoupled administration back-end with API-access for larger sites.

For reservations, my impression is that they often have a back-end system hosted locally to handle their business. If that is the case - and indeed their local system is not impeding their ease-of-use - then a small lodge or hostel might only want customers to be able to inquire about availability. In this case a contact-form with times and dates would suffice, which most CSS frameworks accomodates.

For a medium-sized business relying on reservations I would want more direct integration with the system they use locally, but integrate it in the same manner as an eCommerce site: Separate front-end for the reservation/booking-system, hosted alongside the rest of the site. Example services for this include Checkfront or Planyo - both of which seem to have excellent integrations and free-tiers for small businesses. Any large business using reservations will have dedicated systems across the line.

1 Like

I’m certain that GravCart would not work for me, as I would be selling glass such as water pipes and smoking accessories. GravCart uses Paypal and Stripe, they both state selling any kind of smoking paraphernalia is breaking their terms and conditions. Would Reaction Commerce work as a solution for me, I went to their site but don’t quite understand how to integrate it with grav.

PayPal and Stripe are addons, and you could extend GravCart in the same manner to use a different payment option. I am unfamiliar with Reaction Commerce, but it seems capable enough, though certainly built for scale rather than ease of integration. Given that it has a full API it is definitely possible to use it, but if you are not an experienced developer you will need to outsource the work of integrating it with any front-end.

What happened to GravCart.com ? dead site

The original author stopped developing and maintaining it years ago, see GitHub - flaviocopes/grav-plugin-shoppingcart: Grav ShoppingCart Plugin - NOT SUPPORTED, NOT MAINTAINED.

1 Like

Hey fellows, my 2 cents in to the box.

GravCart or Grav ShoppingCart plugin is now a dead as a brick. BUT you can use it to jump-start your storefront.

The one issue is that it is user-based i.e. it does everything on the user side. So in modern days that is no-no. But, and this is important one - you can take it and redo to be a server-centric.

In my case I use Grav as a Vendure frontend. ShoppingCart is used to jumpstart my categories and product page structure and templates. Almost all JS went to the bin and was replaced by calls to Vendure integration plugin I wrote.
So now Grav speaks GrqphQL and has a nice native storefront.

P.S. As you can see there is no easy way. Grav is out of picture mainly as today Node.JS is a thing pretty much anywhere. I am considering to publish my connector+modified ShoppingCart fork but not any time soon.

It would be quite interesting to hear more about your setup with Vendure, and details on how you integrated it with Grav. I would encourage you to do a write-up and publish said fork, it would be helpful to many others.

1 Like

I can share some details as of it is now.
I created a plugin that exports a TWIG function.

This function accepts query name as an argument and returns the response from Vendure. Plugin has a query catalog so each time the function is triggered in Twig, it searches the catalog and executes a query through constructed client.

As we can return an array of things, we can pars it in TWIG and assign values to needed variables that we will manipulate, effectively constructing page blocks with delivered data.

That works surprisingly fast even for a complex pages. The trick is to have the query tailored for specific need so it has the most of the data required in response.

Sure this is very high level description, but I am still in the process of hacking it all together so that is why it is to early to show any real code.

As I’ve mentioned - I took Shopping cart plugin as a base and slowly refactoring it to move away from the JS towards queries.
The most challenging so far is the user session, that also should go through the Vendure connector somehow. I might need to hack into Gravs user management/auth routine to hook in authentication without really creating any user in GRAV.

P.S. the queries are shop specific so in case if I will share the code there will be no quires and only placeholders. The power and drawback of Vendure is it’s customization and that what stands it out from the rest of well known/adopted e-commerce solutions out there.

1 Like

A post was split to a new topic: Performance: How many visitors can Grav withstand?

Can Grav be used as a CMS for building an e-commerce site, or is it better to use a different platform like Reaction Commerce for scalability and blogging features?

Hi @buymode

I have asked myself the same question as you. The answer I found is: yes, you can use Grav as an e-commerce site, but you have to rely on third party services (just as you could do with any website, since there is no built-in option).

Famous plugins of well-known CMSs also rely on third-party services as payment methods. So, if the options provided by that service work for you (integration, stock, invoicing, crm…), you already have e-commerce with Grav.

1 Like