This project is not covered by Drupal’s security advisory policy.

This module provides a new product variation trait that permits a variation to bundle other products for sale at a fixed price. It allows the merchant to configure the bundled products on the variation form and statically the price for each individual product in the bundle.

Key Features

  • Two bundle types: "One of Each" and "Customer Choice"
  • Extensions for Add to Cart and Shopping Cart forms
  • Field formatting for a bundle's total price display
  • Ability to control visible product variations by product variation type
  • Integration with commerce_stock

Add to Cart form alteration

The Add to Cart form for bundles is altered based on the bundle type:

“One of each” bundles

Lists the products included in the bundle, and for products with multiple variations, the customer is prompted to select which variation is added to the cart. (Note that price differences between variations within a single product will be ignored; the price will be the single static price set for the bundle item.)

“Customer choice” bundles

Show as many select lists as there are “Number of selections” supported by the bundle with the product variations being listed by title in the select list. This lets you construct a bundle where customers choose a variable number of options from among the supported bundle items (e.g., buy 3 of these 6 books for $20).

Add to Cart form submission

When a bundle Add to Cart form is submitted:

  1. A primary order item is created for the bundle, which is priced at $0. The order item should have enabled the “Bundles other order items” trait.
  2. Secondary order items are created for each bundle product priced at the bundle price. These order items are reference by the primary order item through a custom entity reference field in the primary order item.

This architecture allows order processors to operate on the secondary order items individually (e.g., to accommodate different tax rates for the different types of product in the bundle). It also ensures that the individual order items can be accommodated in shipping calculation, exports to third party systems, etc.

Cart and Checkout display

When viewing the cart or checkout, the pricing will be summed up to be visible only at the bundle order item level. The price and adjustments for each bundled product will still be at the secondary order item level, but the module alters the display of the unit price and total of the primary order item to show a single, summed bundle price.

Additionally, whenever a primary order item is removed from the cart, all of its secondary order items are removed as well.

Stock enforcement

The Commerce Bundle Trait module has the “Commerce Bundle Trait Stock Enforcement” sub-module that provides integration for bundle products with the Commerce Stock module. It allows using the “Commerce Stock Enforcement” for bundle products and control their availability from the bundle item products.

Configuration

  1. Create a product type with a product variation type that has the “Bundles other products” trait enabled
  2. Create an order item for the variation type with the “Bundles other order items” trait enabled

You can optionally enable the “Included variation types” trait for the bundle product variation type to control visible product variations of the bundle.

Project information

Releases