Customizable product CP1 has two relationships R1 and R2. Relationship R1 contains two component products P1 and P2. Relationship R2 contains the customizable product CP2. CP2 contains one relationship R3, which has two component products P3 and P4.

The product paths for this customizable product are as follows:

Here are examples of using product paths in script methods:

  1. To add 1 P1:

    AddItem("$.[CP1]#1", "R1", "P1", "1")

  2. To add 1 P3:

    AddItem("$.[CP1]#1.[R2]#[CP2]", "R3", "P3", "1")

  3. To reduce the quantity of P3 to 0:

    RemoveItem("$.[CP1]#1.[R2]#[CP2].[R3]#[P3]")

  4. To set the attribute Color to Red for P1:

    SetAttribute("$.[CP1]#1.[R1]#[P1]", "Color", "Red")

Product Administration Guide > Customizable Product Scripts >

About Product Path


The product path is the path from the root of a customizable product to a component product within it. The path is a string that specifies the customizable product root and all relationship names leading to the component product. All or part of the product path are arguments to several scripting methods.

The syntax for product paths is as follows:

$.[Root Product]#1.[Relationship]#[Component Product]

Observe the following guidelines for product paths:

  • The $ before .[Root Product] refers to a special configuration object called the basket. The basket contains all the objects in the customizable product.
  • The #1 after [Root Product] refers to the first instance of the root product in the basket.
  • Use a dot (.) to specify a relationship.
  • Use a # to specify a component product within a relationship.
  • Enclose relationship names and component product names in square brackets
    ([ ]). Use product name syntax to specify the name of a component product.
  • All paths must end with a product name.

Figure 14 shows the structure of customizable product CP1.

Product Administration Guide