---
title: "saveProduct Method"
canonical: https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.editor.saveproduct.htm
archived: true
applies_to:
  - product: "Customer's Canvas On-Premises"
  - product: "Design Editor"
    versions: ["6.15.0", "6.x (may differ)"]
---

**You’re viewing outdated documentation.** [View the latest Customer’s Canvas On-Premises documentation](https://customerscanvas.com/docs/on-premises/).

# saveProduct Method

**Applies to:** Customer's Canvas On-Premises; Design Editor 6.15.0, 6.x (may differ) · **Archived documentation**
 
### Callable
 
- saveProduct(stateId?:  string, data?:  object ) :  Promise &lt; [ISaveProductResult](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.editor.isaveproductresult.htm.md) &gt;

- Saves a product current state. For details, see the [Introducing the IFrame API](https://customerscanvas.com/docs/cc6/handling-product-customization.htm.md) topic.
  
 - example
     - ```
    // Saving a product to the "t-shirt.st" file.
    editor.saveProduct("t-shirt")
        // If the product is saved correctly.
        .then(function (result) {
            // Get the promise properties.
            userId = result.userId;
            stateId = result.stateId;
            returnToEditUrl = result.returnToEditUrl;
            console.log("User " + userId + " successfully saved state " + stateId);
        })
        // If there was an error thrown while saving the product.
        .catch(function (error) {
            console.error("Saving product failed with exception: ", error);
        });
    ```

#### Parameters

    - #####  Optional stateId: string 
  
        Specifies a state file name without an extension, up to 36 symbols length. If such a file exists, it will be overwritten. You can pass this parameter for any user except **master** and **default**. If you omit this parameter, then a new file name is generated.
    - #####  Optional data: object 
  
        Data for personalization. You can pass either **dataSet** or **itemsData** into this method.

        - #####  Optional dataSet:  [IDataSet](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.objectmodel.idataset.htm.md) 
  
            Creates a new product from the initial product definition and applies variable data to it.
        - #####  Optional itemsData:  [IItemsData](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.objectmodel.iitemsdata.htm.md) 
  
            Applies a single set of variable data to the product.

#### Returns Promise &lt; ISaveProductResult &gt;
 
    Returns a promise with a return-to-edit URL, userId, and stateId.
