Ecommerce With Hugo

Hi I am in interested in creating a ecommerce site with Hugo, just wondering whether it can be added in via a plugin etc. I am currently using Drupal Commerce and deployment is a huge PITA as I can’t just have everything compiled into a single binary. Hugo seem to have quite a few features now, shouldn’t it be upgraded from static site generator status to CMS? :slight_smile:

It could certainly be built. However, commerce requires that each user has it’s own ‘state’. To accomplish this, you’d likely need a client-side cart perhaps like this one: I’ve never used it. I found it by searching for JavaScript commerce and ignoring anything server side.

Another way to do it would be to use Drupal as a back end to store products and display them via json. Checkout would require an offsite solution. (corrected per excellent reply from remote data author.)

I’m happy someone is asking for such a feature :slight_smile:

I have already started working on implementing Magento with Hugo. Magento deployment is the same PITA as with Drupal Commerce and as everybody knows Magento speed is even more PITA.

My implementation is based on two parts:

  1. give Hugo the capability to import a Menu (Magento Categories) via JSON and also to import pages (Magento product view pages) as a JSON stream. This is implemented in my hugo fork and only some tiny stuff for the menu import is missing.
  2. Generate Hugo compatible pages and categories with Magento. This needs some more work. I’ve created a Magento module. The advantage with this is that product maintenance can be done in the Magento backend by even non-tech-people.

The second point there needs to be a proper export of the category pages. Now category export will not work.
Export of product view pages is already working but the Magento theme needs to be changed to Markdown with a lot of HTML in it. I definitely need help here.

To provide a cart feature Magento REST API must be changed to accept a frontend session instead of OAuth session. There are already working solutions for this. With the patched REST API you can now build an e.g. AngularJS client which posts the add to cart request to a Magento backend. Also the cart page itself in Hugo pulls the data from the Magento REST API. Same goes with the checkout. So the AngularJS app is currently also missing.

The reason why I’ve abandoned the project on the Magento side are listed here but I’m still interested. The Hugo feature for importing a JSON stream of pages will come.


and then read that with Hugo’s new remote data features.

This won’t work and the features are not build for such a use-case.

1 Like

Me too :slight_smile:

I’m working on something. May take a couple of months or years until finished and can be integrated into hugo :sweat_smile:

Hey @Immortalin,

I know I’m awfully late to the party, but still, I thought I’d drop this here:

Static Site E-Commerce: Integrating Snipcart with Hugo

It’s an how-to post we crafted a few months ago to show devs how to integrate our HTML/JS-based shopping cart to a Hugo static site. Pretty sure it could be valuable for people looking to set up e-commerce projects with Hugo.

Would love to know what y’all think about it!

Cheers :slightly_smiling:


Interesting! I am just diving in and have start looking how one can include e-commerce, contact forms etc.

I probably will start by basing it on a nice theme and then make it easy to configure for different solutions.