Personalized Products
This endpoint is for Administrator use only. Do not use this endpoint on your customer-facing frontends.
You can allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. You can do this
- using the API by configure the the custom_inputsattribute when you create a product.
- using Commerce Manager when you create/update a product. See Personalizing Products.
Below is an example of a create a product request with the custom_inputs attribute configured.
{
  "data": {
    "type": "product",
    "attributes": {
    /*** other product attributes ommitted ***/
    "custom_inputs": {
              "input": {
                  "name": "Input",
                  "validation_rules": [
                      {
                          "type": "string",
                          "options": {
                              "max_length": 50
                          }
                      }
                  ],
                  "required": false
              }
          }
      }
  }
}
When configuring the custom_inputs attribute:
- You can rename inputto something more representative of the input that shoppers are adding, for example,messageorfront.
- nameis the name that is displayed in your storefront.
- You can add validation rules. For example, the input field must be a stringand/or up to 255 characters in length. The limit is 255 characters.
- You can specify if the input field is required.
For example, you may sell T-shirts that can have personalized text on the front and back of the shirt.
{
  "data": {
    "type": "product",
    "attributes": {
    /*** other product attributes ommitted ***/
    "custom_inputs": {
        "front": {
          "name": "T-Shirt Front",
          "validation_rules": [
            {
              "type": "string",
              "options": {
                "max_length": 50
              }
            }
          ],
          "required": false
        },
        "back": {
          "name": "T-Shirt Back",
          "validation_rules": [
            {
              "type": "string",
              "options": {
                "max_length": 50
              }
            }
          ],
          "required": false
        }
      }
    }
  }
}
Once you have configured your custom inputs on a product, you must configure the custom inputs in your orders. See adding your products to carts. When the product is added to the cart, those custom inputs are supplied.
{
  "data": {
    "type": "cart_item",
    "attributes": {
    /*** other product attributes ommitted ***/
    "custom_inputs": {
        "T-Shirt Front": "Jane",
        "T_Shirt Back": "Jane Doe's Dance Academy"
        }
      }
   }
}
If the same product has different custom_inputs attributes, then these are added as separate items in a cart.
The custom_inputs attribute is stored in the cart item and must not exceed 1MB. When a cart is checked out, the custom_inputs attribute becomes part of the order.
When you add products to a cart with custom_inputs, there are certain limitations on the usage of the custom_inputs with the following promotion types:
- For Free Gift Promotions, you can add custom_inputsto gift items.
- For Fixed Bundle Discount Promotions, the promotion applies as long as the cart contains the bundle SKUs even when there are different custom_inputs.
- For X for Y Discount Promotion and X for amount discount promotion, the promotion applies when there are two SKUs with the same custom_inputs. The promotion does not apply when there are differentcustom_inputsand the SKUs are in different line items.