Skip to content

02. Configuration

Nathaniel Hammond edited this page Jan 19, 2017 · 2 revisions

Settings

  • Bundle ID Handle (bundleIdHandle) - This is the handle used in the item options array in the cart to group bundle items together Default: bundleId
  • Bundle ID Salt (bundleIdSalt) - Salt used to encrypt the bundle ID for slight obscurity Default: appId
  • Bundle SKU Handle (bundleSkuHandle) - The field handle to use for the bundle SKU. If left blank Bundle item SKUs will be combined Default: e.g. ITEM1SKU-ITEM2SKU-ITEM3SKU

Twig Filters

  • cartBundleIdEncrypt - Used to encrypt the bundle ID for use in the cart Usage: bundleEntry.id | cartBundleIdEncrypt
  • cartBundle - The main function, when passed the cart lineItems it iterates through all the items to bundle products together. It then returns the lineItems with the new bundle products and removes individual products that are part of a bundle Usage: cart.lineItems | cartBundle

Variables

  • cartItemsCount - Returns the number of items in the cart after bundling appropriate items Usage: craft.cartBundle.cartItemsCount

Hooks

  • modifyCartBundles - allow manipulation of the bundles before they are added into lineItems
  // Arbitrary example of removing first bundle
  public function modifyCartBundles( &$bundles ) {

    if ( count( $bundles ) ) {
      unset( $bundles[ 0 ] );
    }

  }

Clone this wiki locally