Overview
The plugin's namespace is johnhenry\bundlebuilder. Access the plugin instance via BundleBuilder::getInstance().
Element
elements\Bundle
A purchasable element (extends craft\commerce\base\Purchasable).
use johnhenry\bundlebuilder\elements\Bundle;
$bundles = Bundle::find()->type('bundles')->all();Notable members:
| Member | Description |
|---|---|
getType(): BundleType | The bundle's type. |
getProducts(): BundleProduct[] | The bundle's components (product + qty). |
getIsAvailable(): bool | Post/expiry window + component stock check. |
populateLineItem(LineItem) | Resolves chosen variants, writes options + snapshot, validates stock. |
afterOrderComplete(Order, LineItem) | Decrements component variant inventory. |
getTaxCategoryId(): int | Returns the apportioned category for multiple supply bundles. |
elements\db\BundleQuery
Adds type(), typeId(), postDate() and expiryDate() params on top of the standard purchasable query.
Models
models\BundleType: a bundle type (field layout, formats, site settings, preview targets, tax treatment).models\BundleTypeSite: per-site URL settings.models\BundleProduct: a component (productId, qty, sortOrder).
Enums
enums\PricingStrategy:Fixed,Automatic.enums\DiscountType:Percentage,Flat.enums\TaxTreatment:Composite,Multiple.
Twig variable
craft.bundleBuilder → variables\BundleBuilderVariable (bundles(), getBundlesForProduct()).
See Services for the service layer.