Real-time stock updates for Drupal Commerce shops with Node.js and web sockets

mikl

In building a webshop that sells products where each item is uniquely designed and patterned, and thus can only be sold once, we had the challenge of coming up with a solution that could minimise (if not completely eliminate) occations where multiple customers tries to purchase the same product at the same time, leaving one of them to be disappointed, since only one customer can get the item.

For this purpose, we designed a way of providing real-time indications to the user that a product might be on its way to being purchased by someone else, using Node.js and WebSockets.

In this presentation, I will show how this was built, as well as provide some insight to the potential challenges of rolling out a system like this on a big e-commerce platform.

Session Track

Front end

Experience Level

Advanced

Drupal Version