Skip to content

kmac420/stock-dependencies-for-woocommerce

Repository files navigation

Stock Dependencies for WooCommerce Plugin

Overview

With Stock Dependencies for WooCommerce, you can make the products and variations in your WooCommerce store dependent on the inventory of your other products or variations. Customers will be able to select and purchase the product without seeing the products on which it depends in their cart, during their checkout, or on their receipt. Inventory management in Woo Commerce is greatly simplified since you only have to manage inventory levels for the item(s) on which your product or variation is dependent.

Stock Dependencies for WooCommerce works for Simple and Variable product types in WooCommerce and you can make a product or variation dependent on a combination of other products and variations. Stock Dependencies for WooCommerce lets you create dependencies on quantities of one or more of the other products.

Stock Dependencies for WooCommerce is ideal for:

  • Selling products in multiple quantities. For an product you already have in your inventory, you can use Stock Dependencies for WooCommerce to sell, for example, a package of six items and and package of 12 items. With Stock Dependencies for WooCommerce you do not need to maintain inventory levels for each quantity of the product as the product inventory is managed for only the single quantity item.
  • Selling bundled products. You can create a bundle of multiple items and sell them as a single item. With Stock Dependencies for WooCommerce your customers will only see the bundle product in their cart, during the checkout process, and on their order receipt. You do not need to manage the inventory of the bundled item as it's availability is determined by the availability of the dependencies.

When a product with stock dependencies is displayed in your store, Stock Dependencies for WooCommerce will check the inventory of the products on which it depends and will only show the product as being available if all the dependent stock items are available. When a product with stock dependencies is added to a shopping cart and eventually purchased, the customer will only see the single product in their cart and order, and will not see the products on which it is dependent. When the product is purchased, Stock Dependencies for WooCommerce will reduce the inventory of the items on which it is dependent by the appropriate amount.

How it works

Product management

Stock Dependencies for WooCommerce is easy to configure for any simple or variable product in your WooCommerce store. A single checkbox is added to each simple product or variation in your WordPress admin that allows you to enable stock dependencies for that product or variation. Once checked, two fields are added for the SKU and the quantity of the dependency. Additional dependencies can be easily added.

For example, if you are selling individual bottles of wine in your WooCommerce store, but also want to sell wine in cases of 12 bottles, you can create a product with two variations:

  1. Quantity: Single bottle

    This variation will have inventory managment enabled, will have a unique SKU, and you will enter the price and total number of bottles as the available stock.

  2. Quantity: Case of 12 bottles

    You will configure this variation with a unique SKU and a price. This variation will have stock dependencies enabled and will have a dependency on the single bottle variation with a dependency quantity of 12. Once the product variation is configured with a stock dependency, you never have to manage its inventory.

Shopping

When a customer views a product with dependencies in your WooCommerce store, they will see the product as you have configured it, but the available quantity and in-stock status will be determined by the Stock Dependencies for WooCommerce plugin from the available quantities of each of the products and variations on which it is dependent.

In our example from above, the customer views the product page for the wine and will select a variation of either a single bottle or 12-bottle case. Let's say you have 100 bottles of wine in your inventory, the first variation will show a total of 100 bottles available and the second variation - the case of 12 bottles

  • will show a total of 8 cases available (since you can fill and ship only 8 cases from your 100 bottles).

As purchases are made, only the inventory quantity for the single bottle of wine is changed.

Cart, checkout, and receipt

Customers will only see the product they selected, and not the products upon which it is dependent, in their shopping cart, during the checkout process, and on their purchase receipt. When a purchase is made, the Stock Dependencies for WooCommerce plugin will automatically reduce the inventory of the dependencies by the quantity of the order times the quantity of the dependency.

In our wine example, the customer will see the case of wine in their shopping cart, during the checkout process, and on their receipt (i.e. they will not see the 12 individual bottles of wine).

Setup and configuration of Stock Dependencies for WooCommerce

Installation

Install the WooCommerce Stock Dependencies plugin

  1. Download and install the plugin from the release page or install directly from the WordPress plugin directory.
  2. Activate the plugin.

Important WooCommerce Setting

The Stock Dependencies for WooCommerce plugin will not work properly if your installation of WooCommerce has a (non-zero) value for the Hold stock (minutes) setting. To change this setting, navigate to the WooCommerce > Settings > Products > Inventory page and remove the value in the Hold stock (minutes) field and save your changes.

Configuring Stock Dependencies for a simple product

As an example of using Stock Dependencies for WooCommerce for a simple WooCommerce product, we will use the WooCommerce sample data and create a simple product called Beanie with Logo 2-pack that has a dependency on the sample Beanie with Logo product with a dependency quantity of 2.

  1. In your WordPress admin, navigate to the Products listing page.
  2. Create a duplicate of the Beanie with Logo product and call it Beanie with Logo 2-pack.
  3. Give the new product the SKU Woo-beanie-logo-2-pack.
  4. Save the product.
  5. Navigate to the Inventory tab and check the Add stock dependency checkbox. Simple Product settings
    • Note that when you check the Add stock dependencies checkbox the Manage stock? field will automatically be checked and the Stock quantity field will be automatically set to 0 and both fields will be converted to read-only fields.
  6. In the newly added stock dependencies fields, add the SKU (Woo-beanie-logo) and the quantity (2) for the product dependency. Note that you cannot add the SKU of the current product and the plugin will prevent you from doing so. Adding the SKU and quanty for a stock dependency
  7. If you want to add an additional stock dependency, click on the Add stock dependency link immediately below the existing stock dependency fields. Adding and additional stock dependency
  8. Save your product changes.
  9. Navigate back to the Product listing page and you will see that the available inventory on the Beanie with Logo 2-pack is half of the inventory available for the Beanie with Logo product. Product listing showing stock dependency

Configuring Stock Dependencies for a variable product

As an example of using Stock Dependencies for WooCommerce for a variable WooCommerce product, we will use the WooCommerce sample data and convert the grouped product called Logo Collection to a variable product where each variation has a dependency on the sample T-Shirt with Logo, Hoodie with Logo, and Beanie with Logo products. The T-Shirt with Logo and Hoodie with Logo sample products will also be converted to variable products.

  1. In your WordPress admin, navigate to the Products listing page.
  2. Edit the Logo Collection product and change the product to a variable product.
  3. Save the product.
  4. Navigate to the Attributes tab and select Size from the select menu and click the Add button.
  5. In the Attribute settings box, add the sizes Small, Medium, and Large to the list of Value(s) and check the Used for variations checkbox.
  6. Save the product changes before proceeding.
  7. Navigate to the Variations tab and select Create variations from all attributes from the select menu.
  8. Save the variations.
  9. After the product data reloads, navigate back to the Variations tab and expand all the variations.
  10. For each of the three variations (Small, Medium, and Large) we will add the SKU and price, and stock dependencies. | Variation | SKU | Price | | --- | --- | --- | | Large | Logo-collection-L | 85 | | Medium | Logo-collection-M | 85 | | Small | Logo-collection-S | 85 |
  11. For the Large variation settings we will add the stock dependencies.
    • Check the Add stock dependencies checkbox. Simple Product settings
      • Note that when you check the Add stock dependencies checkbox the Manage stock? field will automatically be checked and the Stock quantity field will be automatically set to 0 and both fields will be converted to read-only fields. These settings are required for the Stock Dependencies for WooCommerce plugin to function correctly.
    • Add the dependency SKU Woo-hoodie-with-logo-L and quantity 1 for the first stock dependency.
    • Click the Add stock dependency link to add another stock dependency row.
    • Add the dependency SKU Woo-tshirt-logo-L and quantity 1 for the second stock dependency.
    • Click the Add stock dependency link to add another stock dependency row.
    • Add the dependency SKU Woo-beanie-logo and quantity for the third stock dependency. Adding the SKU and quanty for a stock dependency
  12. Repeat the same steps for the Medium variation stock dependency settings:
    • Check the Add stock dependencies checkbox.
    • Add the dependency SKU Woo-hoodie-with-logo-M and quantity 1 for the first stock dependency.
    • Click the Add stock dependency link to add another stock dependency row.
    • Add the dependency SKU Woo-tshirt-logo-M and quantity 1 for the second stock dependency.
    • Click the Add stock dependency link to add another stock dependency row.
    • Add the dependency SKU Woo-beanie-logo and quantity for the third stock dependency.
  13. Repeat the same steps for the Small variation stock dependency settings:
    • Check the Add stock dependencies checkbox.
    • Add the dependency SKU Woo-hoodie-with-logo-S and quantity 1 for the first stock dependency.
    • Click the Add stock dependency link to add another stock dependency row.
    • Add the dependency SKU Woo-tshirt-logo-S and quantity 1 for the second stock dependency.
    • Click the Add stock dependency link to add another stock dependency row.
    • Add the dependency SKU Woo-beanie-logo and quantity 1 for the third stock dependency.
  14. Save your variation changes.

Allowing Backorders

The Stock Dependencies for WooCommerce plugin supports dependencies on simple and variable products that are configured to allow backorders. In order to allow backorders on simple or variable products that have stock dependencies on other simple and/or variable products, you must enable backorders for the products on which there is a dependency and the product that has the dependency.