Skip to content

Product Bundles

Flow ID: CF-24 | Module(s): product_bundles, Product domain | Complexity: Medium

Business Overview

Bundles create rule-based discounts when specific product combinations are in the cart. Uses criteria/reference system with two behaviors and two pricing strategies.

Key concepts:

  • Bundle Behavior: OneTime (1, applies once) or Recurring (2, all matching quantities)
  • Pricing Strategy: Constant (1, fixed discount) or Scalar (2, tiered by quantity)
  • Reference Types: ProductId (1), ProductCodeId (2), CategoryId (3), VendorId (4)

API Reference

REST Endpoints

MethodPathAuthDescription
GET/rest/product/bundleGuestList bundles
GET/rest/product/bundle/{id}GuestGet bundle with relations
POST/rest/product/bundleBackendCreate bundle
GET/rest/product/bundle-criteriaGuestList criteria
GET/rest/product/bundle-pricingGuestList pricing tiers
GET/rest/product/bundle-displayGuestList display settings
GET/rest/product/bundle-builder-referenceGuestList references

Cart Integration

  1. Labeling: labelBundledProducts() — load active bundles → sort by weight → check criteria → label items
  2. Pricing: applyBundlePricingToCartLiveData() — calculate bundle_save_price, adjust final_price
  3. Order: Applied bundles saved to shop_order_basket_options_applied_bundles

Discount formula: instancedProductSavePrice = (price × qty) × (discount/100)


Domain Layer

ComponentPath
Bundle Servicesrc/Domains/Product/Bundle/Service.php
Bundle WriteServicesrc/Domains/Product/Bundle/WriteService.php
Sub-entitiesCriteria, Pricing, Display, BuilderReference, CriteriaReference
BundleBehavior Enumsrc/ProductBundles/BundleBehavior.php

Client Extension Points

  • PRODUCT_BUNDLES.ENABLED: Feature gate
  • Weight priority: Higher weight = processed first
  • Custom criteria: Override BundleReferenceSet matching
  • HATEOAS API: AdvApiProductBundlesAdmin exposes _links for client discovery