---
title: Services
date: 2026-07-02T14:42:00+01:00
author: John Henry Donovan
canonical_url: "https://johnhenry.ie/plugins/bundle-builder/docs/api-reference/services"
section: Plugins
---
esc

↑↓ to navigate↵ to selectesc to close

Menu On this page 

- [Return to top](#)

Documentation

Documentation

# Services

Access services from the plugin instance:

```php
use johnhenry\bundlebuilder\BundleBuilder;

$plugin = BundleBuilder::getInstance();
$plugin->getBundleTypes();
$plugin->getBundlePricing();
$plugin->getBundleCart();
```

## `services\BundleTypes`

CRUD for bundle types, their field layout and per-site settings.

MethodDescription`getAllBundleTypes(): BundleType[]`All types, indexed by ID (memoized).`getEditableBundleTypes(): BundleType[]`Types the current user can manage.`getBundleTypeById(int): ?BundleType`A type by ID.`getBundleTypeByHandle(string): ?BundleType`A type by handle.`getBundleTypeSites(int): BundleTypeSite[]`A type's site settings.`saveBundleType(BundleType, bool): bool`Validate + save a type, its field layout and site settings.`deleteBundleTypeById(int): bool`Delete a type, its bundles and field layout.

## `services\BundlePricing`

Automatic pricing.

MethodDescription`getComponentsSubtotal(Bundle): float`Summed sale price of the components.`getComponentPrice(Product): float`A component's default-variant sale price (promotional price if one applies, otherwise its regular price).`calculatePrice(Bundle): float`Components subtotal minus the configured discount`recalculateBundlesForProduct(int): void`Re-save automatic bundles containing a product. Queued via `jobs\RecalculateBundlePrices` rather than called directly; see Pricing.

## `<strong>services\BundleCart</strong>`

Cart-time variant resolution, snapshot and inventory.

MethodDescription`applyToLineItem(Bundle, LineItem): void`Resolve + validate variants, write options + snapshot.`getSelections(LineItem): array`The component selections from a line item snapshot.`decrementComponentStock(LineItem): void`Decrement chosen variants' inventory on completion.

## Adjuster

### `adjusters\BundleTaxAdjuster`

Registered on `OrderAdjustments::EVENT_REGISTER_ORDER_ADJUSTERS`. For *multiple supply* bundle line items it apportions tax across components by selling-price share, taxing each at its own rate against whatever tax rates/zones/categories are configured in Commerce: VAT, GST, sales tax, or otherwise. See [Tax Treatment](https://johnhenry.ie/plugins/bundle-builder/docs/guide/tax-treatment).

On this page
