The Bundle Product package provides you with the ability to combine multiple products in your Wix Store and sell them as one package (bundle). A bundle contains child products.
When a customer purchases a bundle, or if you make changes to a bundle’s inventory manually, the inventory for both the bundle and the child products will decrease.
Note: This package does not currently support products for which you manage inventory based on the product's variants.
Before using the package, set up the following:
Add a Wix Store to your site.
Navigate to the Products page in your site’s Dashboard.
In addition to adding your products, add your bundles as if each bundle is one product. For example, let’s say you have a fitness equipment store and you want to create a yoga bundle with all yoga products, and a training bundle with all training products. Your bundles should look something like this:
Note: As shown in the picture above, you can set the inventory to be a numerical quantity or In Stock / Out of Stock.
Create a database collection called 'Bundles' on your live site (not just the sandbox) with the following fields. This data collection connects your bundle products to their child products.
In the collection, create a row for each of your bundles with the following information:
Field 1: The name of your bundle.
Field 2: Your bundle product ID.To get your bundle product ID, go to the Products page in your site’s Dashboard. Click your product bundle and notice the URL in the browser. You can find your bundle product ID in the following URL:
Field 3: Your child product IDs. Separate each child ID with a comma. To get your child product IDs, go to the Products page in your site Dashboard. Click a child product of the bundle you used in Field 2. Notice the URL in the browser. You can find your child product ID in the following URL:
Repeat this process to get all child product IDs belonging to the bundle product you added in Field 2.
Note: You can also get your Product IDs by going to the Products page in your site Dashboard and downloading the products as a CSV file. The Product ID is the string after the underscore:
Your collection should look something like this:
The following backend file is included in the package. Note that the functions in this file don’t need to be called, they will run automatically when the specified events occur.
The code in this file contains 2 events that make a change to your inventory when fired. This file contains the following functions:
Decreases the inventory quantity of a given bundle when a customer submits payment for an order that includes a child product of that bundle.
Decreases the inventory quantity of a child product when a customer submits payment for an order that includes its parent bundle.
onInventoryVariantUpdated(event)
Updates the inventory of a given bundle when you manually make changes to the inventory of its child products in your site’s Dashboard. You must refresh the inventory page to view the updates.
Note that you cannot make manual changes to the inventory of a bundle. The code will recalculate the quantity of the bundle inventory based on the inventory of its child products.
Note: You can set the inventory to be a numerical quantity or In Stock / Out of Stock.
This section demonstrates how you can work with the package, and the different options for using the package functionalities. Note that this package does not require you to add any code. To use this package, you only need a Wix Store and a database collection.
Let’s use the example in the Setup section to explain how this package works and how to use it. Let’s say you have a fitness equipment store and you want to create a yoga bundle with all yoga products, and a training bundle with all training products.
There are 2 events that will make changes to your inventory:
When a customer submits payment for an order. When a customer purchases a yoga mat, the inventory quantity of the yoga mat will decrease, and the yoga bundle inventory will decrease as well. Similarly, if a customer purchases a yoga bundle, the inventory quantity of the yoga bundle will decrease, and the yoga mat, yoga block, and water bottle inventory will decrease as well.
When you manually make changes to your inventory in your site’s Dashboard. When you manually make changes to the inventory of the yoga mat in your site’s Dashboard, the inventory of the yoga bundle will update as well. You must refresh the inventory page to view the changes.
Note that manual changes to the inventory of the yoga bundle will not change its inventory. The code will recalculate the quantity of the yoga bundle inventory based on the inventory of its child products only.
Note: Inventory can be a numerical quantity or In Stock / Out of Stock.
If a customer purchases a product, the inventory quantity of any bundle that includes this product will decrease as well. If a customer purchases a bundle, both the inventory quantity of the child products and other bundles that include any of these child products will decrease as well.
In our example, notice that both bundles include the water bottle as a child product. If a customer purchases a water bottle, the inventory quantity of the yoga bundle and the training bundle will decrease as well. If a customer purchases a training bundle, the inventory quantity of the water bottle and the yoga bundle will decrease as well.
If a product is out of stock, any bundle that includes this product will be out of stock. If a bundle is out of stock, it means that one or more of its child products are out of stock.
In this case, if the water bottle is out of stock, both the yoga bundle and the training bundle will be out of stock. If the training bundle is out of stock, it means that either the kettlebell 10kg, trx straps, and/or water bottle are out of stock.
1.0 Initial version.