White paper: Templates in web-to-print.  Free download

getVariableItems Method

Callable

  • getVariableItems( ) : Promise < IVariable [] >
  • Lists all variable items in the product.

    example
    editor.getProduct()
        // If we have successfully obtained the product.
        .then(function (product) {
            return product.getVariableItems();
        })
        // If we have successfully obtained an item list.
        .then(function (items) {
            if (items.length)
                items.forEach(function (item) {
                    console.log(item.name);
                });
            else
                console.log("This product contains no variable items.");
        });
    

    Returns Promise < IVariable [] >

    An array of variable items. The isVariable property of these design elements is set to true. Also, this array contains in-string and interpolation placeholders.