You can analyze in detail which products on your website are added to a wishlist. "AddToWishlist" is typically set as the product status if the "add to withlist" button has been clicked.

Methods

The addToWishlist object contains the following four methods, which are contained in the objects data and parameter:

  • set: Overwrites all existing values.
  • add: Overwrites only the corresponding values.
  • get: Returns the current configuration.
  • remove: Removes the current configuration or individual values.

data

set

/**
 * @param {{
 *      id: string,
 *      [cost=0]: number,
 *      [quantity=0]: number,
 *      [variant=""]: string,
 *      [soldOut=false]: boolean,
 *      [parameter={}]: {[number]: string},
 *      [category={}]: {[number]: string}
 * }[]} data
 *
 * @returns {wtSmart.product.addToWishlist.data}
 */
wtSmart.product.addToWishlist.data.set(data);
JS

add

/**
 * @param {{
 *      id: string,
 *      [cost=0]: number,
 *      [quantity=0]: number,
 *      [variant=""]: string,
 *      [soldOut=false]: boolean,
 *      [parameter={}]: {[number]: string},
 *      [category={}]: {[number]: string}
 * }[]} data
 *
 * @returns {wtSmart.product.addToWishlist.data}
 */
wtSmart.product.addToWishlist.data.add(data);
JS

get

/**
 * @returns {{
 *      id: string,
 *      cost: number,
 *      quantity: number,
 *      variant: string,
 *      soldOut: boolean,
 *      parameter: {[number]: string},
 *      category: {[number]: string}
 * }[]}
 */
wtSmart.product.addToWishlist.data.get();
JS

remove

/**
 * @param {number[]} [removeAddToWishlist]
 *
 * @returns {wtSmart.product.addToWishlist.data}
 */
wtSmart.product.addToWishlist.data.remove(removeAddToWishlist);
JS

Example

var product = {
    id: 'ABC-123',
    cost: 99.90,
    quantity: 2,
    soldOut: false,
    variant: 'green',
    parameter: {
        1: 'L'
    },
    category: {
        1: 'tops',
        2: 'noname'
    }
};

// set product addToWishlist data
wtSmart.product.addToWishlist.data.set([product, product2]);

// add product addToWishlist data
wtSmart.product.addToWishlist.data.add([product3, product4]);

// get product addToWishlist data
var data = wtSmart.product.addToWishlist.data.get();
  
// remove all product addToWishlist data
wtSmart.product.addToWishlist.data.remove();

// remove only the first (product) product addToWishlist data
wtSmart.product.addToWishlist.data.remove([1]);
JS

parameter

set

/**
 * @param {{[number]: string}} data
 *
 * @returns {wtSmart.product.addToWishlist.parameter}
 */
wtSmart.product.addToWishlist.parameter.set(data);
JS

add

/**
 * @param {{[number]: string}} data
 *
 * @returns {wtSmart.product.addToWishlist.parameter}
 */
wtSmart.product.addToWishlist.parameter.add(data);
JS

get

/**
 * @returns {{[number]: string}}
 */
wtSmart.product.addToWishlist.parameter.get();
JS

remove

/**
 * @param {number[]} [removeAddToWishlist]
 *
 * @returns {wtSmart.product.addToWishlist.parameter}
 */
wtSmart.product.addToWishlist.parameter.remove(removeAddToWishlist);
JS

Example

// set product addToWishlist parameter
wtSmart.product.addToWishlist.parameter.set({
    1: 'bar'
});

// add product addToWishlist parameter
wtSmart.product.addToWishlist.parameter.add({
    7: 'foo.bar'
});

// get product addToWishlist parameter
var data = wtSmart.product.addToWishlist.parameter.get();
  
// remove all product addToWishlist parameter
wtSmart.product.addToWishlist.parameter.remove();

// remove only product addToWishlist parameter 7
wtSmart.product.addToWishlist.parameter.remove([7]);
JS