Product Bundle Woes

Pencil Case as product bundle

This week, a recurring problem with an implementation of ERPNext hampered efforts to sell product bundles with ease.

A product bundle is a great feature in ERPNext which allows you to group other items available for sale, into another item created specifically for the purpose of grouping the others. When you register the sale of this group, you only enter the bundled item code, and ERPNext automatically adds the list of the bundled items you have defined, so they can be packaged, delivered, and most importantly, registered or tallied for proper inventory.

I have been recently using office supplies to exemplify.

Pencil Case and Pencil Case Bundle

Let’s imagine we are selling only these office supplies:

  • Paper
  • Pencils
  • Erasers
  • Pencil Cases

We have thus four Items in our stock module. Each item has its default warehouse listed as: Office Supply Shelf 1. This shelf is a child warehouse from a parent named Office supplies warehouse.

Now, we want to sell another product, a Pencil Case containing a Pencil and an Eraser. For this purpose we create one more Item in ERPNext, with one condition: We will not be keeping track of its availability in the stock module. It is simply a “placeholder” item, for which we can track sales quantity and amounts, and it does not affect inventory for itself. So we create an item named Pencil Case Bundle.

With the item created, now we can move ahead with the creation of the product bundle. In it we indicate that for each Pencil Case Bundle we will be selling one pencil, one eraser and one pencil case. We save this product bundle definition, and we are now ready to create our first delivery note or sales invoice with this item.

Selling one Pencil Case Bundle

So, we create a sales invoice, and add the Pencil Case Bundle to it, selling only one of it. We check the Update inventory checkbox. Upon saving, ERPNext will list the individual items defined in the bundle, for packaging: 1 Pencil, 1 Eraser, 1 Pencil Case. The way inventory is managed by this placeholder item is by way of a packing list being added to the sales order, delivery note or invoice, and the items being registered in the stock ledger upon validating.

All is running smoothly until I try to validate the Sales invoice. I get the error that the warehouse chosen must be a node (or child) not a parent.

At this point there are two solutions:

  1. You can manually update the warehouse for each of the packing list items.
  2. You can edit the product bundle item checking the maintain stock checkbox, adding the correct warehouse, saving it, and then removing the maintain stock checkbox (as required for a product bundle) and then saving it again.

Solution 1 will allow you to quickly issue the invoice and move on with business for your customer. It is a single occurrence so the inconvenience is small. For further invoices, and for bundles with more items, it becomes more tedious and adds time to the checkout process.

However, once you have validated one of these invoices with a product bundle, option 2 is no longer possible. You can no longer edit the maintain stock field.

Sure, you could delete and recreate everything, making sure first that the bundle item is saved with maintain stock checked and the correct warehouse listed, and re-create all the sales invoices and delivery notes, but if you have several product bundles already created, this can become quite the task.

My Solution

I opted for a quicker solution to this problem, without editing, erasing and re-creating, so that the user does not have to manually specify the warehouse each time.

Before doing anything: Take a Snapshot or backup your server! lest you turn the product bundle woes into the “corrupted database woes”.

This involved logging in to the terminal for the ERPNext server, accessing the mysql database shell, and issuing some commands. First, access the mariadb /mysql shell:

mysql -u root -p

use [database-name];

  1. Verify that the product bundle item has a default_warehouse listed. Contrary to what one would expect, even though maintain stock is not used for the product bundle item, it does list a warehouse as default. At the prompt:

SELECT * FROM tabItem WHERE item_code LIKE ‘[Product-bundle-item-code-goes-here];

2. Now, change the warehouse to the desired warehouse, making sure the chosen warehouse is a node or child warehouse.

UPDATE tabItem SET default_warehouse='[desired_default_warehouse]' WHERE item_code='[Product-bundle-item-code-goes-here]';

Repeat this for each Product Bundle item that is giving you trouble!

Log out of the database with



Now, when you create a Sales Order, Delivery Note or Sales Invoice, the correct warehouse will be automatically updated, and you shall no longer have the Product Bundle Woes.




Behold! There is a lot of lettuce, basil, kale, arugula, etc. (and plenty of useful, valuable software code too!)

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Pair Programming: A Risk Assessment

Build in public — 1

CS371p Fall 2021: John Mackie

Exploiting Functional Parallelism with Kafka

READ/DOWNLOAD![ Building Microservices with .NET C

How to set up Virtual Environment in Anaconda for Image Annotation with LabelImg

Delivering Customer Experiences — Codup with Freshworks

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alain Berger

Alain Berger

Behold! There is a lot of lettuce, basil, kale, arugula, etc. (and plenty of useful, valuable software code too!)

More from Medium

How to accelerate eCommerce growth with digital product sampling

How to accelerate eCommerce growth with digital product sampling

Business Strategy Recommendations

5 Key Learnings In The Journey of Transitioning to Product Marketing

Marketing 101: Brand Architecture