In this blog post, we will explore a scenario on how to automatically include a child product in the order process when a specific attribute is selected in the cart. To accomplish this, we will create an Advanced Rule, and as part of this rule, we will generate a Product Relationship, Vlocity Entity Filter, and leverage the Vlocity Rule Builder.
For instance, during the order process, when configuring the product in the cart, selecting the color attribute as Silver will automatically add the child product to the cart. In our scenario, we will use the Incipio Canvas Fabric Wrap Case – iPhone X as the child product, Apple iPhone X as the parent product, and configure the color attribute available on the parent object.
Create Product Relationship
Step 1 : In the Lightning tab navigation bar, click on “Product Relationships.” Next, click on “New.” In the New Product Relationship dialog, enter the necessary information. For example, give any name, and in our scenario, select the Incipio Canvas Fabric Wrap Case – iPhone X as the related product, and enter “Apple iPhone X” in the product field. Once done, click on “Save.”

Note : The removal of relationships automatically holds significant importance, particularly in the Energy & Utilities Cloud. In the context of orders for commercial Energy customers, the child products within a bundle often represent unit rates, and distinct unit rates are applicable under various conditions. It becomes crucial to automatically remove rates that are not applicable from the Cart.
Step 2 : As we are set to automatically add the product as a child, choose “Auto Add” for the Relationship type, and in the AddMode field, select “asChild.”
Note : To enable the “asChild” option, the product to be added must be configured as a child to the original product, with a default quantity set to zero.
Create Vlocity Entity Filters
Step 3 : Navigate to the Lightning tab navigation bar and click on “Vlocity Entity Filters.” Proceed to click “New” to create a new Entity Filter. Enter the necessary information and save it.

Step 4 : Now, add conditions to the filter by scrolling down to the “Entity Filter Conditions” section and clicking on “Add.” In the Type field, select “Attribute.” In our case select Mobile devices and than color attribute. Click save and mention Silver as value.


Note :
Evaluation: Determines if a set of object records matches specific conditions. Returns true or false. If you use an Evaluation type, you will also need to enter information in the Evaluation Criteria field. Options for this field are All, Any or None.
Qualification: Determines if a set of records qualify to be acted upon. Returns qualified line items.
Create Vlocity Rules
Step 5 : Navigate to the Vlocity Rules tab and click on “New.” In the rule header, input the required information as shown in the screenshot below. Then, add the Configuration/Validation rule to the advanced rule as an action. Lastly, remember to click “Save.”

And that concludes the configuration. Now, let’s proceed to testing.
Testing what we configured
Navigate to the Order tab, configure a new order, and add Apple iPhone X as the parent product.

You will notice a few products listed as children, but they are not yet added as line items. To do so, configure the parent product, and upon selecting the Silver color attribute, the Incipio Canvas Fabric Wrap Case – iPhone X will be automatically added as the child product in the order line item.

Hope this information helps you guys.
Cheers!!!
Mukul Sharma