saveProduct Method

Callable

  • Saves a product current state. For details, see the Handling Product Customization topic.

    example
    // Saving a product.
    editor.saveProduct()
        // 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.

    Returns Promise < ISaveProductResult >

    Returns a promise with a return-to-edit URL, userId, and stateId.