Kees Hink
Kees Hink
14 mei 2018

Building a small webshop with Oscar

We recently built a webshop for a local store. We used Oscar and Wagtail. In this post, we'll share our insights.

Introduction

A supplier of ours turned to us because their website malfunctioned. We fixed their site, and offered to build them a webshop, which they accepted. This gave us the opportunity to try out Oscar in a very different settings than what we’re used to. What did we have to do to get to a minimal viable product? How helpful was Oscar?

De nieuwe webshop van Barrique

The customer

The customer is Barrique, a local wine, beer and liquor store. They also sell lemonade and tonic, for obvious reasons.

Shop-specific tweaks

Oscar is an e-commerce platform, and not a ready-to-go webshop. We had to customize some things to get the site, and our customer, up and running. These customizations included:

  • Create / customize templates and styling, not to be underestimated. This theme was picked by the customer.
  • Customize registration e-mails
  • Set an Order pipeline
  • Integrate with Mollie using Oscar-Mollie (which uses Mollie’s Python API)
  • Send an e-mail to the shop owner when an order is placed
  • Make shipping free over 150 euros (with custom shipping methods)
  • Disallow shipping to PO Box
  • Add a “color” atribute for glitter bottles, with a discrete number of manageable color options.

Oscar’s nestable product categories worked great out of the box.

We also wrote a manual for managing the site. We really overestimate people easily, and Oscar’s Dashboard can be intimidating for novice users.

Rarities

Real customers sometimes have interesting requests:

Variable VAT rate per product

Alcohol is 21%, lemonade is 6%. We override the StockRecord to allow for this.

Variable shipping costs

The shop offers free shipping in the neighborhood. We could have implemented this in the default shipping method, but our customer couldn’t provide a way to determine what was “in the neighborhood”.

Furthermore, our customer’s shipping agent charges extra for delivering to the islands. It would have been interesting to implement this, but as a list of postal-codes wasn’t available, we didn’t implement this.

For these scenarios, we created extra shipping methods, and let the clients pick the right one.

Pull requests sparked by this project

As we proceeded, we made some minor improvements on existing software.

Oscar has optional stock tracking. If enabled for a product type, stock-tracking products of that type will be deduced from stock, influencing availability.

The method consume_stock_allocations() updates stock data, for example when an order is paid or shipped. Previously you had to pass the lines to allocate as a parameter: consume_stock_allocations(order, lines). We made a PR for Oscar to make the lines argument optional: consume_stock_allocations(order). If lines is omitted, all lines’ stock allocations are consumed. This also works if not all line products are stock-tracking.

We made some small improvements to Oscar’s test and documentation setup, and small fixes for Transifex and django-oscar-mollie.

The result

The customer is happy with their site, which has some bespoke features tailored to their situation. We’ll add more features in the future.

If you want help with Oscar questions, just drop us a line.

And now, please head over to the site (Dutch only) and place your order!

We love code