Chord OMS
Content Management (CMS)

Kits and Bundles

13min
introduction chord's oms platform supports two methods of selling a collection of products under a single price 1\ kit (static bundle) 2\ bundle (dynamic bundle) this document will review these two options to choose your best action what are kits? a kit is a pre selected, fixed collection of products under a single sku your customer cannot modify the products within a kit however, you can create multiple kits which contain all the combinations of products they wish to sell bundles offer the same functionality as kits but with more flexibility and less duplication when a kit product is synced to the oms, it creates multiple variants by permuting all possible combinations of these same variants for the products within the kit for example, consider a kit called plants that consists of three products and their variants product variants sku plant 1 plant 1 large plant 1 large plant 1 small plant 1 small plant 2 plant 2 red plant 2 red plant 2 green plant 2 green plant 3 plant 3 plant 3 the oms will generate a product called plants with the following variants 1\ plant 1 large|plant 2 red|plant 3 2\ plant 1 large|plant 2 green|plant 3 3\ plant 1 small|plant 2 red|plant 3 4\ plant 1 small|plant 2 green|plant 3 the master sku for the kit product is the combined skus of all parts separated by pipes using the example above, the plants kit will have a master sku of plant 1|plant 2|plant 3 	 create a kit in the cms, create a new entry of type kit set the store variable sync sku based bundles to enabled when oms syncs the kits and bundles with the cms, it will set the sku of the bundle to the permutation of all products in the kit what are bundles? a bundle is a dynamically selected collection of products the products within a bundle are not pre defined within oms like they are with kits instead, customers who add a bundle to their cart may then choose from a collection of variants (called parts ) to add to the bundle a store can define what parts are within a bundle through the front end and prevent users from changing the bundle's contents in this manner, a bundle can behave similarly to a kit without requiring oms to create and manage multiple variants this is useful if your store offers large numbers of possible parts within a bundle imagine maintaining distinct variants for every single combination of colors that a child can select in a pack of crayons the bundle has a single price regardless of which parts a customer adds however, you can choose which parts may be added to a bundle a bundle is comprised of multiple parts a part can be a product (including all its variants) or a specific variant create a bundle in contentful, create a new content model named bundle click on add content type name your new entry bundle, and click create click add field add the following fields click on the content tab and select bundle in the dropdown, click add entry and individually add each product that is part of the bundle once done, publish your entries we strongly suggest creating and testing bundles in your staging environment first data model product a boolean bundle was added to the product model to denote whether or not the product is a singular product or a bundle of products for example, the following products are bundles and will have bundle true product id name 1 plant bouquet 2 plant bouquet 3 plant bouquet bundlespart used to define and validate what products may be added to a specific bundle it also defines the maximum quantity of parts allowed within the bundle for example, consider the bundles defined above bundle id part id count 1 1 2 4 3 6 api add a bundle to the cart to add a bundle to the cart, the app calls post /api/orders/{order number}/line items the payload will include the sku , variant id , and id of the bundle, along with the list of variants to include in the bundle within the parts array note that the parts array is within the options object the payload for adding a bundle to your cart x{ "line item" { "sku" "kit 1", "quantity" 1, "options" { "parts" \[ { "sku" "part 1", "quantity" 1 }, { "sku" "part 2", "quantity" 1 } ] } } } the line items array in the order response will look like this "line items" \[ 	{ 	 "id" 159, 	 "quantity" 1, 	 "price" "65 0", 	 "variant id" 329, 	 "variant" { 	 "id" 329, 	 "name" "starter kit", 	 "sku" "kit", 	 }, 	 "is bundle"\ true, 	 "parts" \[ 	 { 	 "id" 170, 	 "sku" "part 1", 	 "quantity" 1 	 }, 	 { 	 "id" 171, 	 "sku" "part 2", 	 "quantity" 1 	 } 	 ] 	} ] updating/removing parts from a cart once a bundle is in a cart, parts can be added or removed using the /api/orders/{order number}/line items/{line item number} endpoint, where the line item number is the id of the line item for the bundle the payload is { 	line item { 	 id 1, 	 part line items \[ 	 { 	 id 1 	 sku 'sku 1', 	 destroy true 	 } 	 ] 	} } misc code notes parts in the api payload are converted to part line item attributes hash in the normalize part params method the part line item attributes hash is attached to the line item attributes in the options array the part line item is created when the line item is created in the spree ordercontents#after add or remove method uses some rails magic to instantiate the part line item