Warwickshire, UK

Websites are awesome when they work well and working well should not be a challenge! That said, planning and thought need to go into making something awesome. Many years ago we tackled a missing feature in Drupal Commerce ‘out of stock notifications’.

What happens when a product is out of stock and a customer wants to be notified when its back in stock. Adding this feature to the Drupal Commerce module is straightforward enough, so we set out to plan how it should work. We had already created a notification system (for the store owner admin) for items running low on stock. But this new feature had to send a notification to users who had requested when an item was back in stock. It was logical to integrate the ‘customer stock notification’ with a feature that updates stock so both processes would be in sync and automated. Can you think of anything more painful that manually checking who wanted to be notififed for individual items once they returned back to stock?

The simple plan is as follows. Once a visitor on the website finds the item they want to buy (after an onsite search unless it was a direct hit after a google search) they see a notice out of stock.

Because the item is out of stock we dispay message with a link. The message and link can be anything but we chose ‘to get notices on stock update’

The visitor has to login or register to get notices. This step is important because we can only notify someone via an email. Remember we are keeping it simple! If we really wanted to keep it simple we would just finish by sending an email to admin everytime someone requests an item stock notice and admin would hve to follow up manually for every request to be notified! This would be a massive headache. Why opt for something so simlpe and hard work for the admin when we can eliminate the hardwork! So, instead we automate the notices! when someone asks to be notified they are added to a list along with the item they have requested to be notifed for. This list is then looped though when an items stock is changed. If the item updated is in the list the user is sent an email along with the available stock!

And there we have it, automating the stock notices isn’t so difficult but logical with Drupal. Using triggers when an item’s stock level is updated we loop through items for users who requested a stock update and this trigger automatically sends an email with the stock amount the item has been updated by. Simple!

Would you like this module installed on your Drupal Commerce ?

drupal commerce stock notice

What if the product is DISCONTINUED

The solution for sending stock notifications for products out of stock is good to go.  However, what do you do when a product is DISCONTINUED !  You don’t want to let your customers down.  And they are certainly going to do one of 2 things.  They will try and locate the exact item from somewhere that still has the item or they will try and find an alternative. Drupal is awesome there is no doubt about it.  Why it is awesome is also why ‘website developers’ shy away from using it!  Drupal does not jump out of the box with built in solutions!  Drupal Commerce is no exception.  If you want ‘considered to be standard’ features Drupal Commerce does not tick this box.  So just like the ‘out of stock notification’ system we are going to need a ‘Item DISCONTINUED’ feature.  And here it is. Although the DISCONTINUED item is related to the ‘out of stock notification’ feature it is a seperate feature and will require adding separately.  That said, it is straightforward enough to do.  Take a look at the basic overview for the Drupal Commerce DISCONTINUED Alternative Products

Share the Post:

Related Posts