• PXM Products/
    PXM Product Variations/
    PXM Product Variation Modifiers API/
    Modifiers API Overview

    Modifiers API Overview

    Product Experience Manager (EP PXM) modifiers help augment the properties of a product variation by creating an array of child products. For each product, you can specify a modifier type and the value to define how that property changes the variation options when you build child products.

    Modifier Types

    You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The different types of modifiers are:

    ModifierData TypeEffect
    name_equalsstringOverrides the name of the child product with the name specified by the modifier.
    name_appendstringAppends the string specified in the modifier to the name of the child product.
    name_prependstringPrepends the string specified in the modifier to the name of the child product.
    description_equalsstringOverrides the description of the child product.
    description_appendstringAppends the string specified in the modifier to the description of the child product.
    description_prependstringPrepends the string specified in the modifier to the product description of the child product.
    commodity_typestringSets the commodity type of the child product, such as physical or digital.
    commodity_typestringSets the commodity type of the child product, such as physical or digital.
    pricestringAllows application of price modifiers (price_increment, price_decrement, and price_equals) to the child products.
    price_incrementstringIncreases the price of the child product.
    price_decrementstringDecreases the price of the child product.
    price_equalsstringSets the price of a child product to the amount you specify.
    slug_appendstringAppends the string specified in the modifier to the slug of the child product.
    slug_prependstringPrepends the string specified in the modifier to the slug of the child product.
    slug_builderstringSets a part of the slug of the child product.
    sku_equalsstringSets the SKU of the child product.
    sku_appendstringAppends the string specified in the modifier to the SKU of the child product.
    sku_prependstringPrepends the string specified in the modifier to the SKU of the child product.
    sku_builderstringSets a part of the SKU of the child product.
    statusstringSets the status of the child product, such as draft or live.

    Modifier related to slugs can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for slug-builder modifier, you can use {} in the seek field, for example, "seek": :{COLOR}".

    Creating SKU and slug builder modifiers

    Attributes - sku_builder

    AttributeTypeDescription
    idstringThe unique identifier for this product.
    typestringThe type of resource object. You must use modifier.
    modifier_typestringThe type of modifier, either sku_builder or slug_builder.
    value.seekstringA search string for the find and replace.
    value.setstringThe replacement string.

    The following code provides an example for request:

    {
      "type": "modifier",
      "modifier_type": "sku_builder",
      "value": {
        "seek": "{PLACEHOLDER}",
        "set": "SKU001-",
      }
    }
    

    The following code provides an example for response:

    200 OK

    {
        "data": {
            "type": "product-variation-modifier",
            "id": "6d31b2d1-6a26-47e5-9ea0-96b392490ab7",
            "modifier_type": "sku_builder",
            "value": {
              "seek": "{PLACEHOLDER}",
              "set": "SKU001-",
            }
        }
    }
    

    Attributes - slug_builder

    NameRequiredTypeDescription
    typeRequiredstringThe type of resource object. You must use product-variation-modifier.
    attributes.typeRequiredstringThe modifier type.
    attributes.seekRequiredstringThe sub-string to match for find and replace.
    attributes.setRequiredstringThe value that will be set for the modifier, such as red.

    The following code provides an example for request:

    {
      "data": '{
        "type": "product-variation-modifier",
        "attributes": {
          "type": "slug_builder",
          "seek": "{color}",
          "set": "red"
        }
      }'
    }
    

    The following code provides an example for response:

    200 OK

    {
        "data": {
            "type": "product-variation-modifier",
            "id": "913095ff-c1ad-4d21-ab09-067e4b74379b",
            "attributes": {
                "seek": "{color}",
                "set": "red",
                "type": "slug_builder"
            }
        }
    }
    

    Creating child product with SKU and slug builder modifiers

    Using the {SKU} and {SLUG} builder modifiers, you can build child products and change a specific part of the slug or SKU of the child products to a specified value.

    For example, a shirt with variations color and Size has an option Red created for color and option Medium created for Size. The following steps build a child product [BASIC-SHIRT-MEDIUM-RED] in the storefront:

    1. Create a sku_builder modifier for the Red option with set value RED and seek value {COLOR} as in the following example:

      {
        "data": {
          "type": "product-variation-modifier",
          "attributes": {
            "type": "slug_builder",
            "seek": "{color}",
            "set": "red"
          }
        }
      }
      
    2. Create another sku_builder modifier for the Medium option with dset value MEDIUM and seek value {SIZE} as in the following example:

      {
        "data": {
          "type": "product-variation-modifier",
          "attributes": {
            "type": "slug_builder",
            "seek": "{Size}",
            "set": "Medium"
          }
        }
      }
      
    3. Make the following request to build a child product in the with SKU [BASIC-SHIRT-MEDIUM-RED] for the base product with SKU [BASIC-SHIRT-{SIZE}-{COLOR}]: https://api.moltin.com/pcm/products/:productId/build

    For more information about how to achieve the same results via the API, see Build Child Products.

    Price Book Modifier Objects

    You can apply price book modifiers to the child products of a base product to avoid updating the prices for the child products manually. For example, using the price_equals modifier, you can control the price of the child products. In other words, products are sold at the right price point, instead of the base product price. All prices are set in the price book.

    Attributes

    AttributeTypeDescription
    idstringThe unique identifier for this product.
    typestringThe type of resource object. You must use modifier.
    modifier_typestringThe type of modifier, such as, price_increment, price_decrement, or, price_equals.
    value.amountintegerThe value of the price book modifier.
    value.currencystringThe currency of this price book modifier as a three letter ISO.
    value.includes_taxbooleanThis value is set true if relevant taxes are included in the value. If relevant taxes are not included, set to false.

    See Create a price book modifier

    Sample object

    {
      "type": "modifier",
      "id": "6d31b2d1-6a26-47e5-9ea0-96b392490ab7",
      "modifier_type": "price_increment",
      "value": [
        {
          "currency": "FJT",
          "amount": 46008803,
          "includes_tax": false
        },
        {
          "currency": "YZK",
          "amount": 4011039,
          "includes_tax": false
        }
      ]
    }
    

    Was this helpful?